Abu Ayub reported,

When you go to relieve yourselves, do not face the qiblah while urinating or defecating, but turn toward the east or the west.When we arrived in Syria, we found latrines that had been built facing the qiblah, so we would turn aside from it and seek Allah's forgiveness.

Abu Dawud 9

Sahih

حدثنا مسدد بن مسرهد حدثنا سفيان عن الزهري عن عطاء بن يزيد الليثي

عن أبي أيوب رواية قال

إذا أتيتم الغائط فلا تستقبلوا القبلة بغائط ولا بول ولكن شرقوا أو غربوا فقدمنا الشام فوجدنا مراحيض قد بنيت قبل القبلة فكنا ننحرف عنها ونستغفر الله

أبو داود 9صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Purification
Chapter
Dislike of facing the qibla when relieving oneself
Numbering
Darussalam 9
Abu Dawud 9