He was also asked:
May a person pray in a bathhouse if he fears that the prayer time will expire, or not?
He answered:
If he goes to the bathhouse intending to bathe, leave, and pray outside within the prescribed time, but then finds himself with no choice but to pray in the bathhouse or miss the prayer, praying in the bathhouse is better than missing the prayer. Praying in a bathhouse is comparable to praying in a latrine, in places affected by ritual impurity, and the like. Whoever is in such an impure place and cannot leave it before the prayer time expires should pray there rather than let the time expire, because observing the prescribed time takes precedence over observing all other obligations.
However, if he knows that, by going to the bathhouse, he will be unable to leave before the prayer time expires, this question has already been discussed. The stronger view is that he should perform tayammum (dry purification) and pray, for praying with tayammum is better than praying in places where prayer is prohibited or praying after the prescribed time has expired.