All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Scholars held different opinions regarding the ruling of one who joins the prayer late and whether he should follow the Imaam in the prostration of forgetfulness if the Imaam did so after making Tasleem. The Hanafi and Hanabili scholars view that the one who joins the prayer late should follow the Imaam in the prostration of forgetfulness before standing to make up what he missed for the general indication of the statement of the Prophet, sallallaahu ‘alayhi wa sallam: “And when he (the Imaam) prostrates, then prostrate.” [Al-Bukhari and Muslim]
Also, because the one who joins the prayer late cannot make up what he missed until the Imaam ends his prayer. In the case in question, the Imaam did not end his prayer completely. The Maaliki and Shaafi‘i scholars view that the one who joins the prayer late should not follow him in the prostration of forgetfulness if he does it after the Tasleem. Rather, one should stand to first make up what he missed and, if he completes his prayer, he should prostrate for forgetfulness. They proved this saying that following the Imaam ends when he makes Tasleem. Accordingly, if the following stopped, then one should no longer abide by the Imaam's actions. As for the Hadeeth which those of the first opinion presented, it is regarding following the Imaam during the prayer.
According to what we explained of the opinions of the scholars, each of the two parties mentioned in question is in conformity with a sound scholarly opinion.