When you go to a place to relieve yourselves, do not face or turn your back to the Qiblah (prayer direction); rather, turn towards the east or the west
Chapter: The Qiblah for the people of Al-Madina, Sham and the East.
Authentic
hadith of Sahih al-Bukhari
Muttafaq ‘alayh (Bukhari and Muslim)Sahih al-Bukhari 394
Abu Ayyūb al-Ansāri (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said:
"When you go to a place to relieve yourselves, do not face or turn your back to the Qiblah (prayer direction); rather, turn towards the east or the west." Abu Ayyūb said: We came to the Levant and found lavatories built in the direction of the Qiblah, so, we used to divert ourselves and ask forgiveness from Allah Almighty.
Reported by Al-Bukhari (No. 394), Muslim (No. 264), Abu Dawud (No. 9), At-Tirmidhi (No. 8), An-Nasa’i (No. 21), Ahmad (No. 22476) and Ad-Darimi (No. 663).
The Prophet (may Allah's peace and blessings be upon him) forbade the one who wants to relieve himself by urinating or defecating from facing the Qiblah and the direction of the Ka‘bah and from turning his back to it by making it behind his back. Rather, he should turn away from that direction towards the east or the west in case his Qiblah is like that of the people of Madīnah. Then, Abu Ayyūb (may Allah be pleased with him) reported that when they went to the Levant, they found the lavatories, which were set up for answering the call of nature, built facing the direction of the Ka‘bah. So, they used to divert their bodies from the Qiblah and seek forgiveness from Allah despite that.
Lessons
The rationale behind this is to show veneration and respect for the honorable Ka‘bah.
Seeking Allah's forgiveness after coming out of the place of answering the call of nature.
The good teaching of the Prophet (may Allah's peace and blessings be upon him) because when he mentioned what is forbidden, he guided to what is permissible.
Explanation in Arabic
نَهَى النبيُّ صلى الله عليه وسلم مَن أراد قضاء حاجته من بول أو غائط أن يستقبل القبلة وجهة الكعبة، ولا يستدبرها بأن يجعلها خلف ظهره؛ بل عليه أن ينحرف عنها قِبَلَ المشرق أو المغرب إذا كانت قبلته كقبلة أهل المدينة.
ثم أخبر أبو أيوب رضي الله عنه أنهم لما قدموا الشام وجدُوا فيها المراحيض المعدة لقضاء الحاجة قد بُنيت متجهة إلى الكعبة، فكانوا ينحرفون بأجسادهم عن القبلة، ومع ذلك يستغفرون الله.
الحكمة في ذلك تعظيم الكعبة المشرفة واحترامها.
الاستغفار بعد الخروج من مكان قضاء الحاجة.
حسن تعليم النبي صلى الله عليه وسلم؛ لأنه لما ذكر الممنوع أرشد إلى الجائز.
The polytheists said to us: I see that your companion teaches you everything, even how to relieve yourselves. He said: Yes, indeed. He forbade us from using our right hand for cleaning ourselves, or facing the Qiblah (direction of prayer), and he prohibited us from using dung and bones, and said…