As a shark sails underwater, it takes in water into its mouth. This water passes over the gills of these fishes and then seeps out of it thanks to the gill slits on either side of the shark. It is often referred to as passive breathing or more precisely ram ventilation.
Unlike other fishes, sharks have five gill slits or at times more than that. Water must continually pass over them in order for these fishes to breathe. Gill filaments contain tiny blood vessels. As you know, oxygen is present in seawater and as it passes over its gills, the oxygen is transferred to the blood vessels of the gill openings. There are very small thin membranes inside the gill filaments that ooze carbon dioxide and sucks up oxygen.
The bottom-dwelling sharks like Whitetip reef shark and Nurse shark as well as skates and rays have to pump this oxygen-bearing water into their mouth. However, some of these species also have spiracles on the top of their head with the help of which they pump water into their mouth. Not all sharks have spiracles sure enough which further means that they cannot take a break at the bottom of the sea.
Therefore, those sharks that lack spiracles have to keep swimming or else they die. This is because such sharks can’t breathe while motionless (due to lack of spiracles) and for that reason, they must keep sailing underwater so that they may pump more and more oxygen-bearing water which eventually seeps out through their gill openings.