If the Imam prays an extra Rak'ah and He does not perform the Prostration of Forgetfulness
Question :
A number of us performed the Zuhr prayer behind an Imam and he made the Taslim after praying five Rak'ahs. After the prayer, some of worshippers informed him that he had prayed an extra Rak'ah and thus had prayed five Rak'ahs and he did not perform the prostration of forgetfulness. Was our prayer correct, or not? And what should be done in such circumstances?
Answer:
When the Imam prays an extra Rak'ah in prayer, he must perform the prostration of forgetfulness if he is aware of it. As for those behind him, if they follow him, not knowing that it is an extra Rak'ah, their prayer is correct.
As for those who follow him and they know that he is praying extra and that it is not permissible to do, their prayer is invalid. And they should have informed the Imam of his mistake by saying: Subhan Allah.
If the Imam had insisted upon it, they should not have followed him; they should have remained sitting and waited for him to complete his prayer, then made the Taslim with him. Based upon this, due to the fact that they are ignorant of the ruling, the prayer of those people mentioned is correct, but they should have performed the prostration of forgetfulness if they knew. If they then did not perform the prostration of forgetfulness, their prayer is invalid and must be repeated due to the length of time which has since passed.
Source:
Ibn Jibreen
Fatawa Islamiyah, Vol. 2 Page 279