صحيح ابن خزيمه
Sahih Ibn Khuzaymah
جُمَّاعُ أَبْوَابِ الْآدَابِ الْمُحْتَاجِ إِلَيْهَا فِي إِتْيَانِ الْغَائِطِ وَالْبَوْلِ إِلَى الْفَرَاغِ مِنْهَا
Chapters on Etiquette of Relieving Oneself
(42) بَابُ ذِكْرِ خَبَرٍ رُوِيَ عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فِي النَّهْيِ عَنِ اسْتِقْبَالِ الْقِبْلَةِ وَاسْتِدْبَارِهَا عِنْدَ الْغَائِطِ وَالْبَوْلِ بِلَفْظٍ عَامٍّ مُرَادُهُ خَاصٌّ
Chapter 42: Report on the Prophet’s prohibition of facing or turning one’s back to the qiblah when relieving oneself, in general wording with specific intent
Hadith Number: 57
حدثنا عبد الجبار بن العلاء ، حدثنا سفيان ، حدثنا الزهري . ح وحدثنا سعيد بن عبد الرحمن المخزومي ، حدثنا سفيان ، عن الزهري ، عن عطاء الليثي ، عن ابي ايوب الانصاري ، قال: قال رسول الله صلى الله عليه وسلم: " لا تستقبلوا القبلة بغائط ولا بول، ولا تستدبروها، ولكن شرقوا او غربوا" . قال ابو ايوب: فقدمنا الشام فوجدنا مراحيض قد بنيت نحو القبلة، فننحرف عنها ونستغفر الله. هذا لفظ حديث عبد الجبار
It is narrated from Sayyiduna Abu Ayyub Ansari (may Allah be pleased with him), he says that the Messenger of Allah (peace and blessings of Allah be upon him) said: "When urinating or defecating, do not face the Qiblah nor turn your back towards it, but rather turn towards the east or the west." Sayyiduna Abu Ayyub Ansari (may Allah be pleased with him) says that when we came to (the land of) Sham, we found toilets built facing the Qiblah. So we would turn away from the Qiblah (while sitting in those toilets) and seek forgiveness from Allah. These are the words of the narration of Abdul Jabbar.