قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " إِذَا أَتَى أَحَدُكُمُ الْغَائِطَ فَلاَ يَسْتَقْبِلِ الْقِبْلَةَ وَلاَ يُوَلِّهَا ظَهْرَهُ، شَرِّقُوا أَوْ غَرِّبُوا ".
Abu Ayyub al-Ansari reported: The Messenger of Allah ﷺ said, “When one of you goes to relieve himself, let him neither face the qiblah nor turn his back to it. Face east or west.”
also in Sahih al-Bukhari 394