The legal status of the prostration of forgetfulness differs depending on the situation:
1- The prostration of forgetfulness is sunna for the following:
-a- One praying alone.
-b- An imam.
-C- A follower if the imam forgets something and does not prostrate for forgetfulness.
-d- A latecomer for his own errors which took place after the imam finished his prayer,
-e- A follower for his own errors which took place before joining the imam (Such as starting to pray on his own, making an error, then entering into congregational prayer).
-f- A follower if the imam is Hanafi and performs the prostration of forgetfulness after the prayer's first salam. In this case, the follower is not obligated to follow the imam in the prostration of forgetfulness because his leadership is terminated by finishing with salam.
-g- A latecomer who followed the imam in the prostration of forgetfulness.
In this case, the latecomer is recommended to re-perform the prostration at the end of his own prayer because he performed the first one to comply with the imam and not in its proper place.
The evidence that the prostration of forgetfulness is sunna is that the Prophet (P. B. U. H) said in the above mentioned hadith narrated by Abu Sa'id Al-Khadari (G. p. H)
"... If his prayer has been complete, the rak'a and the two prostrations will be (regarded as)
voluntary".. (pa: 176)
2- The prostration of forgetfulness is obligatory on a follower if his imam performs it before the prayer's first salam.
Moreover, even if one forgetfully makes salam after that of his imam without performing the prostration, he is obligated to return to it if he recalls it immediately, otherwise he has to re-perform his prayer as though he had forgotten one of its pillars.
Anas ibn Maiek (G. p. H) narrated that the Prophet (P. B. U. H) said:
"The imam is to be followed".
[Muslim, The Book of Prayer, Chapter 19/77. The complete hadith will be cited in the chapter of congregational prayer].