Passing wind and spitting in the direction of the Qiblah
In the name of Allah, the most Beneficent, the most Merciful.
Saaiduna Abu Hurairah narrates that the Prophet of Allah said: “When one of you sits to relieve himself, let him not face towards the qiblah or turn his back towards it.” (Musnad Ahmad and Sahih Muslim)
Saaiduna Abu Ayyub Al Ansari narrates that the Prophet of Allah said: “When you go to defecate, do not face towards the qiblah or turn your back towards it, rather face towards the east or the west.” (Sahih Bukhari and Sahih Muslim)
With regards to your question, the aforementioned ahadith clearly talks about the impermissibility of urinating and defecating in the direction of the Qiblah. It does not talk about passing wind. However, one should refrain from passing wind intentionally towards the direction of the Qiblah.
Regarding spitting, the following hadith shows the impermissibility of spiting in the direction of the Qiblah.
Saaiduna Anas bin Malik narrates that the Prophet of Allah saw some sputum in the direction of the Qiblah (on the wall of the mosque) and he disliked that and the sign of disgust was apparent from his face. So he got up and scraped it off with his hand
and said, “Whenever anyone of you stands for the prayer, he is speaking in private to his Lord or his Lord is between him and his Qiblah. So, none of you should spit in the direction of the Qibla but one can spit to the left or under his
foot.” The Prophet of Allah then took the corner of his sheet and spat in it and folded it and said, “Or you can do like this.” (Sahih Bukhari)
Only Allah Knows Best
Mohammed Tosir Miah
Darul Ifta Birmingham.