What should one who is informed about the correct direction of the qiblah during a prayer?
If there is a congregation praying, and during their prayer they are informed about the right direction of qiblah, they should all turn towards the correct direction. The same is also true for someone praying individually. Whatever part of their prayer has been performed (before changing direction) will be correct. The evidence for this a narration by Imam Muslim from Anas (may Allah be please with him), that:
While the Prophet (peace be upon him) was praying towards Bayt-al-Maqdis (Jerusalem), the verse was revealed to him (translation of meaning):
Verily! We have seen the turning of your face towards the heaven. Surely, We shall turn you to a qiblah that shall please you, so turn your face in the direction of Al-Masjid Al-Haram.
A man from Bani Salamah was passing by and found them (i.e., the people of Bani Salamah) in the state of ruku‘ in the Fajr prayer in the second rak‘ah. He shouted to them: Indeed the qiblah has been changed. So, turn to the qiblah as they (i.e., the Prophet and his Companions) have.
(Sahih Musim, No. 527)
If some of the people were informed and the others were not, then the one to whom it was made clear should turn to the direction he believes to be the correct direction of qiblah. Now if all of these people (who were informed or not) were originally praying together in the same direction, and some of them turned towards right and some towards left, it is correct for some to follow others. But the scholars have a difference of opinion about some people following others in the situation where there was complete disagreement (among the praying people) about the direction of the qiblah. If there was someone among them who was completely ignorant about the direction, he should follow the one who is more aware amongst them of the direction of the qiblah.1 For the one who was uninformed about the direction f the qiblah, must ask someone if he can, or else he should make ijtihad (make a judgment based on the best of his ability with the information available) if he is able to, otherwise he must follow someone who is reliable. If he cannot find one, then he should do his best in obedience to Allah and complete his prayer, and his prayer is correct. This sometimes happens to a number of those who travel to the lands of disbelievers and find no Muslim around them to inform them of the correct direction of qiblah.
If one was capable of finding out the direction of the qiblah, but was neglectful and prayed without making all possible efforts, he should repeat his prayer because he was careless.2
1 Al-Mughni, 1/473.