Is it permissible for the worshipper who missed a rak’ah and found the imam prostrating to say takbeer and then prostrate, or should he wait until the imam gets up?.
If a person comes and finds the imam in a particular posture he should join the imam in whatever posture he is in. So if he comes and finds him prostrating, he should say takbeer and then prostrate, because the Prophet (peace and blessings of Allaah be upon him) said: “Whatever you catch up with, pray, and whatever you missed, make it up.” And because the prostration that he does may be a cause of forgiveness of his sins, so he should not miss out on that. Hence he should prostrate and then stand up with his imam, but that is not counted as a rak’ah for him, because the rak’ah can only be caught up with if one catches up with the bowing (rukoo’). End quote.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him).