In the same network, hosts communicate directly. This is probably through a switch or WAP, but the frames are sent addressed directly from one host to the other host. The switch or WAP is really just a layer-2 bridge between the two hosts. The layer-2 frames are addressed to the destination host.
Routers route layer-3 packets between networks. If a host is sending something to a host on a different network, then the host will send layer-2 frames addressed to its configured gateway (router). The router strips off the layer-2 frames and routes the layer-3 packets based on the layer-3 destination address to a new interface and build a new layer-2 frame for the layer-3 packet using the layer-2 protocol for the new interface.
Once two computers start to communicate with each other, (e.g. start
to transfer a large file via ssh or NFS or ...), can they continue to
communicate if I turn off the router?
We have no information about how your network is configured, but if the two hosts are communicating on the same network, then you never needed a router for that in the first place. The hosts could start, continue, and stop communicating all on their own, even if you never had a router.