Does Turning Away from The Qiblah Invalidate The Prayer?
Question

I want to know whether turning away in prayer is an innovation (Bid`ah) or does it invalidate the prayer?
Praise be to Allah.Turning away from the Qiblah in prayer is of different types:

Turning away physically, by turning one’s chest away from the direction of the Qiblah. This type of turning away invalidates the prayer , because facing towards the Qiblah is one of the conditions of prayer being valid.
Turning one’s head or eyes away, while the body remains facing towards the Qiblah. This type of turning away is disliked, unless the Muslim does it because he needs to.

If he does it with no need, then he has diminished the reward for his prayer but it is still valid and is not rendered invalid by that.
It says in Al-Mawsu`ah Al-Fiqhiyyah (27/109):
“There is no difference of opinion among the jurists regarding the fact that it is disliked to turn away in prayer, because of the Hadith of `Aishah (may Allah be pleased with her), who said: I asked the Prophet (blessings and peace of Allah be upon him) about turning away in prayer and he said: “It is something that Satan steals from a person’s prayer.” (Narrated by Al-Bukhari, 751)
However, it is only disliked if it is done unnecessarily or without an excuse. But if there is a need for that, such as if the worshipper fears for himself or his property, then it is not disliked.”
It says in Fatawa Al-Lajnah Ad-Da’imah (7/27):
“Turning away in prayer is disliked and diminishes its reward, but the one who turns away in prayer is not obliged to repeat his prayer, because in other Hadiths there is evidence which indicates that it is permissible to turn away if there is a need to do so. Thus, it is known that it does not invalidate the prayer.”
There are many hadiths which indicate that it is permissible to turn away in prayer if that is done for a reason, such as the report narrated by Muslim (431) from Jabir (may Allah be pleased with him), who said: The Messenger of Allah (blessings and peace of Allah be upon him) was sick, so we prayed behind him when he was sitting, and Abu Bakr made the people hear the Takbir. He turned to look at us and saw that we were standing, so he gestured to us that we should sit down, and we prayed behind him sitting.
Abu Dawud (916) narrated that Sahl ibn Al-Hanthaliyyah (may Allah be pleased with him) said: “The Iqamah for prayer – meaning Fajr prayer – was given, and the Messenger of Allah (blessings and peace of Allah be upon him) began to pray whilst he kept turning and glancing up at the mountain pass.” Abu Dawud said: He had sent a rider to the mountain pass to stand guard overnight. (Classed as authentic by Al-Albani in Saheeh Abu Dawud.)
Shaykh Ibn Baz (may Allah have mercy on him) said:
“There is nothing wrong with turning away while praying to seek refuge with Allah from the accursed satan when experiencing intrusive thoughts; rather it is recommended when there is an urgent need for it, but it should be done with the head only.” (Majmu` Fatawa Ibn Baz,  11/130)

There is another type of turning away, which is turning away while praying in one’s heart , through thoughts that distract a person so that he does not focus and reflect on his prayer .

Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
You should understand that turning away is of two types:

Turning away in a physical sense, which is turning the head;


Turning away in a metaphorical sense, in the heart. This refers to whispers and passing thoughts that come to the heart. This is a problem that no one is free of; it is difficult to treat it and only few are those who are safe from it. It diminishes the (reward of the) prayer, and would that it was only in part of the prayer. But a person may turn away from the beginning of his prayer until the end, and it may truly be said that this is something that satan steals from a person’s prayer.” (Ash-Sharh Al-Mumti` , 3/70)

And Allah knows best.