The Messenger of Allah ﷺ forbade us from facing either of the two qiblahs while urinating or defecating.
حدثنا أبو النضر حدثنا داود يعني العطار عن عمرو بن يحيى عن أبي زيد مولى ثعلبة
أن رسول الله ﷺ نهى أن نستقبل القبلتين ببول أو غائط
Its chain of transmission is daif, due to the obscurity of Abu Zayd, the freedman of Banu Thalaba, while Maqil Abu Maqil Asadi was a companion, as was his father.Abu Dawud narrated this hadith in 1/20, no. 10, at the beginning of the Book of Purification, in the chapter on the dislike of facing the qibla when relieving oneself, and Ibn Majah narrated it similarly in 1/116, no. 319.