Should he join the imam after he stands up from rukoo’ in the last rak’ah, or wait for the second jamaa’ah?
Question

If I join the imam after he stands up from rukoo’ in the last rak’ah, that means that I have missed that rak’ah, but I heard the sound of another jamaa’ah. So what is better – should I complete my obligatory prayer with the imam or should I regard that as Sunnah and pray with the other jamaa’ah?.
Praise be to Allah.It is better for you to join the imam and then complete what you missed, because of the general meaning of the words of the Prophet (peace and blessings of Allah be upon him): “Whatever you catch up with, pray, and whatever you have missed, make it up.” Narrated by al-Bukhari, 635; Muslim, 602. 
The Standing Committee for Issuing Fatwas received two questions similar to yours. There follows the text of the two questions and their answers. 
Question: Once I went to the mosque to pray ‘Asr and I found the worshippers had done three rak’ahs and they had started the last one and were prostrating. Should I join them or wait until they have finished? 
Answer:  What is prescribed in a situation like this is to join them. Whatever you catch up with, pray with them, and whatever you have missed, make it up. If you join them after they have stood up from rukoo’ in the last rak’ah, then join them and complete the whole prayer after the imam says the tasleem. This is because of the hadeeth narrated by Abu Dawood (may Allah have mercy on him) (893), that Abu Hurayrah (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “If you come to prayer and we are prostrating, then prostrate but do not count it as anything. Whoever catches up with one rak’ah has caught up with the prayer.” And because of the general meaning of the hadeeth narrated by the two Shaykhs al-Bukhari and Muslim (may Allah have mercy on them) from Abu Hurayrah (may Allah be pleased with him) according to which the Prophet (peace and blessings of Allah be upon him) said: “When you come to the prayer do not rush. You should be calm and dignified. Whatever you catch up with, pray, and whatever you miss, make up.” 
And Allah is the Source of strength. May Allah send blessings and peace upon our Prophet Muhammad and his family and companions. 
Question:  If a person catches up with the final tashahhud before the imam says the tasleem, is he regarded as having caught up with the virtue of praying in congregation (jamaa’ah), or will he have the reward of one who prays alone? What is better if he enters the mosque when the imam is reciting the final tashahhud – should he complete the tashahhud or is it better to wait for some others to come and pray with them? 
Answer: The person who catches up with the imam in the final tashahhud is not regarded as having caught up with the jamaa’ah, but he will have a reward commensurate with however much of the prayer he caught up with the imam in. Rather the one who is regarded as having caught up with the jamaa’ah is the one who catches up with at least one rak’ah, because the Prophet (peace and blessings of Allah be upon him) said: “Whoever catches up with one rak’ah of the prayer has caught up with the prayer.” It is better for him to join the imam, because of the general meaning of the hadeeth: “Whatever you catch up with, pray, and whatever you miss, make up.” Narrated by al-Bukhari, 635; Muslim, 602.  And Allah is the Source of strength. 
Fataawa al-Lajnah, 7/319-320 
And Allah knows best.