שולחן ערוך, אורח חיים מ״ה
Shulchan Arukh, Orach Chayim 45
1דין תפילין בבית הקברות ובית המרחץ. ובו ב סעיפים:אסור ליכנס בבית הקברו' או בתוך ארבע אמות של מת ותפילין בראשו משום לועג לרש ואם הם מכוסים מותר:
The laws of tefillin in a cemetery and in a bathhouse: containing two subsections. It is forbidden to enter a cemetery, or within four cubits of a corpse, with tefillin on one's head, because of mocking the poor (lo'eg larash). And if they [the tefillin] are covered, this is permitted.
2בבית המרחץ בבית החיצון שכל העומדים בו הם לבושים יכולים להניח שם תפילין לכתחלה ובבית האמצעי שמקצת בני אדם עומדים שם לבושים ומקצתן ערומים אינו יכול להניחם לכתחלה ואם היו בראשו א"צ לחלצן ובבית הפנימי שכל העומדים שם ערומים אפילו היו בראשו צריך לחלצן:
In a bathhouse: in the outermost section, where everyone is clothed, it is permitted from the outset to put on tefillin. In the middle section, where some are clothed and some are naked, it is not permitted from the outset to put tefillin on, but if one was wearing them on one's head, one does not need to remove them. In the innermost section, where everyone is naked, even if one already had tefillin on one's head one needs to remove them.