The RPi is known to have issues with ssh access randomly malfunctioning.
I’ve run in to this problem myself and you can find plenty of examples on RPi StackExchange … I’ve even answered some of those questions myself once upon a time…
If you have a locally setup keyboard and monitor, I would suggest restarting the ssh server and see what happens.