Sahih Muslim 264
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
إِذَا أَتَيْتُمُ الْغَائِطَ فَلاَ تَسْتَقْبِلُوا الْقِبْلَةَ وَلاَ تَسْتَدْبِرُوهَا بِبَوْلٍ وَلاَ غَائِطٍ وَلَكِنْ شَرِّقُوا أَوْ غَرِّبُوا "
Abu Ayyub reported:
The Apostle of Allah (ﷺ) said: Whenever you go to the desert, neither turn your face nor turn your back towards the Qibla while answering the call of nature, but face towards the east or the west. Abu Ayyub said: When we came to Syria we found that the latrines already built there were facing towards the Qibla. We turned our faces away from them and begged forgiveness of the Lord. He said: Yes.
Full reference and source
Sahih Muslim 264 In-book : Book 2, Hadith 76 USC-MSA web (English) : Book 2, Hadith 507 (deprecated)
View source on Sunnah.com (opens in a new tab)