In the Western world, beach bathing is a late 18th-19th Century phenomenon.
Bathing became fashionable because, like taking spa water, it was thought to be healthful. A form of "taking the cure" for neurasthenia or whatever.
Furthermore, before then nobody went to the beach anyway, and having a tan was for peasants only. It was a sign that you labored outdoors. Nobody knew how to swim, either (as in Italy today).
Native peoples, especially in warm climates, knew how to swim. The Front Crawl, aka Australian Crawl (now universally used for Freestyle racing), was adopted by Western Civ around the turn of the century, via Solomon Islanders who used this speedy stroke.
Here's a history of women's bathing attire. They definitely did not swim in these things. You would rapidly drown. Maybe they just got a little wet up to their knees, and splashed some water on their faces.
Here's a history of swimming.
Even today, most people do not go to the beach to swim. They go to read, to watch their kids play in the sand and waves, to obtain some beneficial rays of the sun, to enjoy a sea breeze blowing over their near-naked body, to take a cooling dip, or to surf or body surf where there are good waves.
And how many places can one go out in public and exhibit one's gorgeous, erotic self in what is basically underwear?
Editor's note: A useful piece of information: The Every Guy's Guide to Judging a Girl in a Bathing Suit. h/t, Linkiest