Yes and no. There are more than 12,000 species of ants all over the world. They are amazing creatures with tremendous strength. An ant can lift 10-50 times its own weight. If a man was as strong as an ant, he would be able to lift a car! They are amazing foragers on land, but most cannot swim. Their bodies can repel water, however, so they can float. We cannot confuse them with Michael Phelps or fish, but, when in water, some species do a sort of funny doggy paddle to propel themselves forward. Let’s face it, their legs are not designed for swimming.
Some species eg. Fire ants are very inventive and have been seen floating in giant masses or rafts after a hurricane or flooding has occurred, surviving until they hit dry land. If the raft gets submerged, the buoyancy pops it right back up. Some interesting species of ants are also comfortable in water. There is a species in Borneo called the diving ant, who dives into plant pitfall traps to capture insects submerged in the plant’s juices. There is a species in Australia that lives in the mangrove swamps that nests in submerged air pockets and then swims to the surface. It is the only species known thus far that can live, swim and navigate under water.