As the imam was supposed to stand up for his fourth rak’ah in Zuhr prayer, he sat instead for a very brief period, thinking that he has finished four rak’ahs and should sit down to conclude the prayer. The congregation reminded him and he stood up for the fourth rak’ah. Should he and the congregation do two prostrations at the end to compensate for this mistake?

The two prostrations at the end of prayer known as Sahu are meant to rectify any mistake or forgetfulness in prayer. If it is a congregational prayer, only the imam’s mistake counts. If he has made a mistake, then he makes up for it by two prostrations, at the end, and the entire congregation follows suit. In the case the reader asks about, the imam has done a mistake, because he sat for Tashahhud when he still needed to do another rak’ah. He would have continued and probably finished the prayer, had the congregation not reminded him. Therefore, two prostrations for Sahu were in order.

I should add that these prostrations are recommended, not obligatory. This means that if a person makes a mistake and rectifies it during prayer, but forgets or omits to do the two prostrations, his prayer is still valid.