Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
tirmidhi:11Hannād > ʿAbdah b. Sulaymān > ʿUbaydullāh b. ʿUmar > Muḥammad b. Yaḥyá b. Ḥabbān from his uncle Wāsiʿ b. Ḥabbān > Ibn ʿUmar

"One day I climbed on Hafsah's house, and I saw the Prophet relieving himself while facing Ash-Sham, with his back toward the Ka'bah."  

Abū ʿĪsá said that this Ḥadīth is Ḥasan-Ṣaḥīḥ.
الترمذي:١١حَدَّثَنَا هَنَّادٌ حَدَّثَنَا عَبْدَةُ بْنُ سُلَيْمَانَ عَنْ عُبَيْدِ اللَّهِ بْنِ عُمَرَ عَنْ مُحَمَّدِ بْنِ يَحْيَى بْنِ حَبَّانَ عَنْ عَمِّهِ وَاسِعِ بْنِ حَبَّانَ عَنِ ابْنِ عُمَرَ قَالَ

رَقِيتُ يَوْمًا عَلَى بَيْتِ حَفْصَةَ فَرَأَيْتُ النَّبِيَّ ﷺ عَلَى حَاجَتِهِ مُسْتَقْبِلَ الشَّأْمِ مُسْتَدْبِرَ الْكَعْبَةِ  

قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ

See similar narrations below:

Collected by Bukhārī, Muslim, Aḥmad
bukhari:148Ibrāhīm b. al-Mundhir > Anas b. ʿIyāḍ > ʿUbaydullāh > Muḥammad b. Yaḥyá b. Ḥabbān > Wāsiʿ b. Ḥabbān > ʿAbdullāh b. ʿUmar

I went up to the roof of Hafsa's house for some job and I saw Messenger of Allah ﷺ answering the call of nature facing Sham (Syria, Jordan, Palestine and Lebanon regarded as one country) with his back towards the Qibla. (See Hadith No. 147).  

البخاري:١٤٨حَدَّثَنَا إِبْرَاهِيمُ بْنُ الْمُنْذِرِ قَالَ حَدَّثَنَا أَنَسُ بْنُ عِيَاضٍ عَنْ عُبَيْدِ اللَّهِ عَنْ مُحَمَّدِ بْنِ يَحْيَى بْنِ حَبَّانَ عَنْ وَاسِعِ بْنِ حَبَّانَ عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ قَالَ

ارْتَقَيْتُ فَوْقَ ظَهْرِ بَيْتِ حَفْصَةَ لِبَعْضِ حَاجَتِي فَرَأَيْتُ رَسُولَ اللَّهِ ﷺ يَقْضِي حَاجَتَهُ مُسْتَدْبِرَ الْقِبْلَةِ مُسْتَقْبِلَ الشَّأْمِ  

bukhari:3102Ibrāhīm b. al-Mundhir > Anas b. ʿIyāḍ > ʿUbaydullāh > Muḥammad b. Yaḥyá b. Ḥabbān > Wāsiʿ b. Ḥabbān > ʿAbdullāh b. ʿUmar

Once I went upstairs in Hafsa's house and saw the Prophet ﷺ answering the call of nature with his back towards the Qibla and facing Sham.  

البخاري:٣١٠٢حَدَّثَنَا إِبْرَاهِيمُ بْنُ الْمُنْذِرِ حَدَّثَنَا أَنَسُ بْنُ عِيَاضٍ عَنْ عُبَيْدِ اللَّهِ عَنْ مُحَمَّدِ بْنِ يَحْيَى بْنِ حَبَّانَ عَنْ وَاسِعِ بْنِ حَبَّانَ عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ ؓ قَالَ

ارْتَقَيْتُ فَوْقَ بَيْتِ حَفْصَةَ فَرَأَيْتُ النَّبِيَّ ﷺ يَقْضِي حَاجَتَهُ مُسْتَدْبِرَ الْقِبْلَةِ مُسْتَقْبِلَ الشَّأْمِ  

muslim:266bAbū Bakr b. Abū Shaybah > Muḥammad b. Bishr al-ʿAbdī > ʿUbaydullāh b. ʿUmar > Muḥammad b. Yaḥyá b. Ḥabbān from his uncle Wāsiʿ b. Ḥabbān > Ibn ʿUmar

I went up to the roof of the house of my sister Hafsa and saw the Messenger of Allah ﷺ relieving himself facing Syria. with his back to the Qibla.  

مسلم:٢٦٦bحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ حَدَّثَنَا مُحَمَّدُ بْنُ بِشْرٍ الْعَبْدِيُّ حَدَّثَنَا عُبَيْدُ اللَّهِ بْنُ عُمَرَ عَنْ مُحَمَّدِ بْنِ يَحْيَى بْنِ حَبَّانَ عَنْ عَمِّهِ وَاسِعِ بْنِ حَبَّانَ عَنِ ابْنِ عُمَرَ قَالَ

رَقِيتُ عَلَى بَيْتِ أُخْتِي حَفْصَةَ فَرَأَيْتُ رَسُولَ اللَّهِ ﷺ قَاعِدًا لِحَاجَتِهِ مُسْتَقْبِلَ الشَّامِ مُسْتَدْبِرَ الْقِبْلَةِ  

ahmad:4606ʿAbdh > ʿUbaydullāh > Muḥammad b. Yaḥyá b. Ḥabbān from his uncle Wāsiʿ > Ibn ʿUmar

[Machine] I travelled one day above Hafsa's house and I saw the Messenger of Allah ﷺ facing towards the direction of Syria and having his back towards the Qibla.  

أحمد:٤٦٠٦حَدَّثَنَا عَبْدةَ حَدَّثَنَا عُبَيْدُ اللهِ عَنْ مُحَمَّدِ بْنِ يَحْيَى بْنِ حَبَّانَ عَنْ عَمِّهِ وَاسِعٍ عَنِ ابْنِ عُمَرَ قَالَ

رَقِيتُ يَوْمًا فَوْقَ بَيْتِ حَفْصَةَ فَرَأَيْتُرَسُولَ اللهِ ﷺ عَلَى حَاجَتِهِ مُسْتَقْبِلَ الشَّامِ مُسْتَدْبِرَ الْقِبْلَةِ  

ahmad:4617Yaḥyá > ʿUbaydullāh > Muḥammad b. Yaḥyá from his uncle > Ibn ʿUmar

"One day I climbed on Hafsah's house, and I saw the Prophet relieving himself while facing Ash-Sham, with his back toward the Ka'bah." (Using translation from Tirmidhī 11)   

أحمد:٤٦١٧حَدَّثَنَا يَحْيَى عَنْ عُبَيْدِ اللهِ حَدَّثَنَا مُحَمَّدُ بْنُ يَحْيَى عَنْ عَمِّهِ عَنِ ابْنِ عُمَرَ قَالَ

رَقِيتُ يَوْمًا عَلَى بَيْتِ حَفْصَةَ فَرَأَيْتُ رَسُولَ اللهِ ﷺ عَلَى حَاجَتِهِ مُسْتَدْبِرَ الْبَيْتِ مُسْتَقْبِلَ الشَّامِ