The Prophet (ﷺ) said, "While defecating, neither face nor turn your back to the Qibla but…

Sahih al-Bukhari Book 8 Hadith 46

Sahih al-Bukhari #394

Prayers (Salat) 8:46

Narrated Abu Aiyub Al-Ansari:

The Prophet (ﷺ) said, "While defecating, neither face nor turn your back to the Qibla but face either east or west." Abu Aiyub added. "When we arrived in Sham we came across some lavatories facing the Qibla; therefore we turned ourselves while using them and asked for Allah's forgiveness."

Chapter: The Qiblah for the people of Al-Madina, Sham and the East.

Grade: Sahih