Sayyiduna Abu Ayyub Ansari (may Allah be pleased with him) narrates that the Noble Prophet (peace and blessings be upon him) said: When you go to relieve yourselves, do not face the Qiblah nor turn your back towards it. Rather, turn your face towards the east or the west at that time. Sayyiduna Abu Ayyub (may Allah be pleased with him) said: When we came to Syria, the toilets there were built facing the Qiblah. (When we went to relieve ourselves) we would turn away and seek forgiveness from Allah, the Mighty and Majestic.
Hadith Referenceاللؤلؤ والمرجان / كتاب الطهارة / 148
Hadith Gradingمحدثین:«صحیح»
Hadith Takhrij«صحیح، أخرجه البخاري في: 8 كتاب الصلاة: 29 باب قبلة أهل المدينة وأهل الشام والمشرق»