The necessity of sleeping at all is a mystery to me, but manifestly almost all animals do sleep. I believe sharks swim continuously because they naturally sink, and also rely on movement to flow water over their gills (most fish can adjust their buoyancy, and pump water through their gills, while asleep). Apparantly, some birds stand on one leg because half their mind/body can sleep at a time (I may be very gullible on this).
Also, being active 24x7 uses much more energy, so the time spent hunting and foraging is much higher.
It is all a matter of finding an evolutionary niche. If all the predators worked 9 to 5 with occasional overtime, so could the prey. A significant minority of animals are nocturnal because it is safer for them, or their prey is out then, or there is less competition. Consider web spiders: they spin at night to maximise the day period when their web is available, and then sleep until they feel the tug of an impact: a prey/predator timeshare.
At least for humans and many primates, their general bad sight and clumsiness means laying low at night is the best option. To avoid predators, they sleep in places that limit the opportunity of attack, such as caves, ledges, trees and islands, and typically move away from their latrines and food areas first to avoid detection by smell.