Fiqh-us-Sunnah Volume 2, Supererogatory Prayer, Fiqh 2.054A.
Whoever joins a congregation, he should perform the opening takbir while standing and then move directly to the act that the congregation may be performing, for instance, if the congregation is prostrating one should perform the opening takbir and then join it in the prostration. However, such a person is not considered as having performed the rak’ah unless he performs the ruku’ (bowing), even if he just bows and puts his hands on his knees, when the imam is finishing his ruku’.
Abu Hurairah reports that the Messenger of Allah sallallahu alehi wasallam said: “If you come to the salah and we are in sajdah, then make sajdah with us but do not count it [as a rak’ah]. And whoever ‘catches’ the ruku’, he catches the salah.” This is related by Abu Dawud, Ibn Khuzaimah in his Sahih, and by al-Hakim, who considers it sahih, in his Al-Mustadrak.