Takbeer of movement (changing posture) for one who joins the congregation when the imam is bowing or prostrating
If (a person) comes when the people are bowing, what he must do first is say the takbeer for starting to pray (takbeerat al-ihraam), then if he can, he should say the takbeer for bowing whilst leaning forward; if he cannot do that, then the takbeerat al-ihraam will suffice, according to the correct scholarly view. But if he does both, that is better and more perfect, and will avoid a matter concerning which the scholars differed. Then he should bow with the imam and this rak‘ah will be valid for him and he does not have to make it up.
But if he comes when they are prostrating, he should say takbeerat al-ihraam only whilst standing, then go down in prostration without saying the takbeer, and this rak‘ah will not count for him, because he missed standing and bowing with them. End quote.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him)