Question: May I recite a blessing while wearing a bathing suit? Is there a distinction between men and women regarding this law?
Answer: Indeed, our Sages taught that one may not utter the name of Hashem while undressed, as the verse states, “And he shall not see anything promiscuous among you.” It is likewise forbidden to recite a blessing when facing another person who is undressed.
A Bathing Suit
Nevertheless, our Sages taught (Berachot 24a) that in a situation where one is dressed in a garment such as a bathing suit, one may recite a blessing. It goes without saying that one must be wearing a Kippah or other head covering at the time, for a man may not mention the name of Hashem with his head uncovered (Shulchan Aruch, Chapter 206).
Women may likewise recite blessings while wearing a bathing suit (as long as she as her front and back are covered, as she would be while seated).
Thus, both men and women may recite blessings in spite of being dressed immodestly.
Reciting a Blessing in Front of Another Individual Wearing a Bathing Suit
There is, however, a distinction regarding one who wishes to recite a blessing while facing someone else who is wearing a bathing suit or otherwise immodestly. A man or woman may recite a blessing while facing another man who is wearing just a bathing suit and there is nothing wrong with this.
Similarly, a woman may recite a blessing while facing another woman who is wearing a bathing suit. However, a man who finds himself facing a woman wearing a bathing suit or dressed otherwise immodestly may not recite a blessing or any other holy words for that matter.
If one is in a situation where there are women dressed immodestly and one needs to recite a blessing on food and the like, one may only do so after shutting one’s eyes.
“You Shall Be Holy”
Almost needless to say, going to a beach where women are dressed immodestly is an extremely grave sin, about which our Sages taught (Berachot 61a), “Anyone who walks behind a woman crossing the river has no share in the World to Come.” On the other hand, one who closes one’s eyes and does not go to such places will merit gazing at the glory and shine of our righteous Mashiach (Midrash Rabba, Vayera).
Summary: Both men and women may recite blessings while wearing a bathing suit (regarding women, she must be at least as covered as she would be while seated). A man who sees a woman dressed immodestly may not recite a blessing; rather, he must shut his eyes and only then bless.