It was narrated from Rafi' bin Ishaq that he heard Abu Ayyub Al-Ansari say - when he was in Egypt:
"By Allah, I do not know what I should do with these Karais (toilets). The Messenger of Allah (ﷺ) said: 'When any one of you goes to defecate or urinate, let him not face toward the Qiblah, nor turn his back towards it." (DE)
Arabic/English book reference (DE): Vol. 1, Book 1, Hadith 20 (DE)