If the prayer of all those standing in the first row comes to an end and they do not immediately join the imam for the next prayer, the congregational prayer of those in the next row becomes invalid. In fact, even if they join immediately, the validity of the congregational prayer of those on the next row is problematic [i.e. based on obligatory precaution, it is not valid].
Ruling 1419.* If a person joins in the second rakʿah, it is not necessary that he recite Sūrat al-Ḥamd and the other surah; however, it is recommended that he say qunūt and tashahhud with the imam. And the obligatory precaution is that when he says tashahhud he must sit in a squatted position, such that his fingers and the balls of his feet are on the ground and his knees are off the ground; and after tashahhud, he must stand up with the imam and recite Sūrat al-Ḥamd and the other surah.
If he does not have enough time to recite the other surah, he must complete Sūrat al-Ḥamd and perform his rukūʿ with the imam. And if he does not have enough time to recite all of Sūrat al-Ḥamd, he can discontinue reciting it and perform rukūʿ with the imam. However, the recommended precaution in this situation is that he should complete his prayer with the intention of performing it on his own.