Praise be to Allaah.
If the latecomer catches up with the imaam in rukoo’, our companions said:
If the person can say ‘Allaahu akbar’ and bow with a pause before he stands up again, then the rak’ah counts for him, but if there is no time to pause before the imaam stands up again, it does not count. If he is not sure, does the rak’ah count? There are two opinions on this, the more correct of which is:
It does not count, because what is more likely is that he did not catch up with the imaam. So he has to do the prostration of forgetfulness (sajdat al-sahw) at the end of the rak’ah that he does after the imaam says the salaam, because he is doing a rak’ah on his own and is not sure whether this is an extra rak’ah or not. This is like the one who is not sure whether he has prayed three or four rak’ahs: he should do another rak’ah then do sajdat al-sahw. One of those who discussed this issue was al-Ghazaali in al-Fatawa. It is a good issue to discuss, because a lot of people have this problem and most people do not know the answer, so this information should be passed on. And Allaah knows best.