It is narrated from Sayyiduna Usamah bin Zayd (may Allah be pleased with him): "The Messenger of Allah (peace and blessings be upon him) forbade facing the qiblah while defecating or urinating." It is also narrated from Sayyiduna Usamah bin Zayd (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Do not face the qiblah while defecating or urinating."
Imam al-Busiri (may Allah have mercy on him) said: The chain of this hadith of Sayyiduna Usamah (may Allah be pleased with him) revolves around Abdullah bin Nafi' (may Allah have mercy on him) (the freed slave of Ibn Umar), and the hadith scholars declared him weak; Ibn Ma'in, Ibn al-Madini, Abu Hatim, al-Bukhari, al-Nasa'i, Ibn Adi and other imams called him da'if (weak).
I say that this hadith has supporting reports (shawahid) in the two Sahihs and other books of hadith from the narrations of Sayyiduna Abu Ayyub al-Ansari and Sayyiduna Abu Hurayrah (may Allah be pleased with them both); and Imam Abu Dawud and Imam al-Tirmidhi also narrated it from the hadith of Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both).