Many land animals have returned to the sea throughout evolutionary history. We have beautifully documented cases from amphibians, reptiles, birds and mammals from over 30 different lineages over the past 250 million years.
Our dear penguins, seals, sea lions, walruses, whales, crocodiles and sea turtles were once entirely terrestrial. Some dipped a toe or two into freshwater ponds, but make no mistake, they were terrestrial. Each of these animals had ancestors that tried out the sea and decided to stay. They evolved and employed a variety of adaptations to meet their new saltwater challenges. Some adapted legs as fins, others became more streamlined, and still, others developed specialized organs to extract dissolved oxygen from the water through their skin or gills. The permutations are endless.
Returning to the sea comes with a whole host of benefits but some serious challenges as well. Life at sea is very different from life on land. Water is denser than air, impacting how an animal moves, sees and hears. More importantly, it impacts an air-breathing animal's movement on a pretty frequent basis. If you need air and haven't evolved gills, you need to surface frequently. Keeping your body temperature at a homeostatic level is also a challenge as water conducts heat much better than air. Even with all of these challenges, the lure of additional food sources and freedom of movement kept those who tried the sea in the sea and they evolved accordingly.
This is an interesting article from Alicia Ault writing for the Smithsonian who interviewed Nick Pysenson and Neil Kelley about some of their research that touches on this area. They published a paper on it in the journal Science back in 2015.
Here's the link: https://science.sciencemag.org/content/348/6232/aaa3716
And Ault's work is definitely worth a read: https://www.smithsonianmag.com/smithsonian-institution/take-deep-dive-reasons-land-animals-moved-seas-180955007/