Babies as young as 6 months can learn to swim.
Through a program called Infant Swim Rescue or ISR, babies learn to float on their backs to rescue themselves in the event they fall into a pool, lake, or whatever on accident. It's amazing to watch these super tiny babies floating on their own. The most amazing part is, to "graduate" they must demonstrate a simulated fall, dressed in winter clothes - puffy coat, boots, hat, gloves, the works, where they rescue themselves and float for a period of time.
We totally did this with our first son. We found the most amazing teacher, Erin, and LOVED her. She's both gifted in teaching and calming babies. I won't lie - it's intense - for baby but even more intense for parents. The schedule alone is intense - we were recommended daily 10 minute sessions for a minimum of 5 weeks. It's also emotionally intense if you are not familiar with this process because babies will cry. And truly, that's part of the goal. Babies will float on their own in the water, but they still need an adult to actually rescue them out of the water, so crying is part of the deal. So it was hard to watch our sweet baby cry through many of his lessons. But with family living near lakes and having friends with pools, it gave me peace of mind knowing he'd be able to fend for himself if he fell in and we weren't able to get to him immediately.
Once they get older, they actually learn to turn on their bellies and kick and then turn back onto their backs to float when they need to rest. The idea is that they can rescue themselves by kicking into the shallow end or steps and walk out by on their own.
ISR methods recommend a refresher each year as their little bodies change so rapidly until they are about 5 when they start to learn actually swim strokes.