As of now no one knows for sure whether sharks doze off or keep on swimming continuously. So it’s a matter of debate that hasn’t been settled yet. But what’s clear is the fact that sharks do indeed have restful periods. Scientists have reported some sharks to remain at stationary positions for hours under the caves in Australia and Mexico. But the spooky thing is: their eyes are still found to be open and are observed to be following the diver’s movements as he moves around.
However not all the species exhibit such kind of behavior and they tend to be more active during the night like tiger shark and reef whitetip. As a matter of course, sharks keep on swimming for good reasons i.e., as they speed up, they tend to pump more and more water into their mouths and over their gills. This way sharks utilize oxygen from the water and keep breathing. This process is known as ram ventilation.
Therefore it is not easy to figure out how do sharks sleep if they ever do. But after several experiments on spiny dogfish shark, experts came to know that swimming movements of sharks (which are coordinated by ‘Central Pattern Generator’) is situated on the spinal cord of the fish instead of its brain. This leads to a hypothesis that a shark can doze off even if it continues to swim. On the contrary, factors like salinity, temperature and water currents mar this hypothesis too.
Sources:
Martin, R. Aidan. “How Do Sharks Swim When Asleep”. ReefQuest Centre for Shark Research