Some marine mammals sleep out of the water, and some may not sleep at all.
The furred or hairy aquatic mammals in the pinniped suborder, seals, etc. have a variety of interesting adaptations that permit them to spend a comparatively long time underwater, sometimes at considerable depths.
However, they rise frequently to breathe and emerge from the ocean to sleep, relax, molt, mate and reproduce on a handy beach, rock, ice floe or snow cave above the water.
Diving tends to be reserved for hunting purposes.
The situation is less clear for cetaceans, whales, etc. and sirenians, sea cows and manatees.
The whales evolved from land animals that returned to the sea millions of years ago.
Though whales come to the surface to breathe air into their lungs, they can spend a remarkably long time between breaths, up to an hour in some species, and spend nearly all their lives underwater.
However, whales learned to hold their breath so well that they lost their involuntary breathing mechanism and must be conscious to continue to breathe.
Not only would a reflex have to take care of breathing, it would have to take them to the surface for air. Also, the blowhole automatically closes and must be opened voluntarily by the whale. Whales would drown if they fell asleep or were knocked unconscious.
The animal must think about each breath. It cannot have an unconscious sleep as we know it.
There are theories that the whale has the ability to rest half of the brain and control breathing functions with the other half, but they are just theories.
Sea cows and manatees tend to live in warm, calm, shallow, vegetation-rich waters where they can float lethargically at or near the surface.
They have an extremely low metabolic rate, do not expend much energy to regulate body temperature and require little oxygen.
Manatees may sleep or rest supported by the bottom. When they hold their breath, large blubber deposits and natural buoyancy let them float at the surface and engage in a resting behavior, though not an unconscious sleep.