It was narrated from Jabir bin 'Abdullah:
"Abu Sa'eed Al-Khudri narrated to me, that he bears witness that the Messenger of Allah forbade facing the Qiblah when defecating or urinating.'"
English reference: Vol. 1, Book 1, Hadith 320
Arabic reference: Book 1, Hadith 341
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.