Abu Huraira reported God’s Messenger as saying, “When you come to the prayer and we are prostrating ourselves you must prostrate yourselves without reckoning it as part of your prayer; and if anyone is present at a rak'a he has been present at the prayer.”
‘Ali and Mu'adh b. Jabal reported God’s Messenger as saying, “When any of you comes to pray and the imam is at a certain point, he must do as the imam does.”
Tirmidhi transmitted it and said this is a gharib tradition.
Anas reported God’s Messenger as saying, “If anyone prays to God for forty days in congregation being present in time for the first takbira, two immunities will be recorded for him, one from hell and one from hypocrisy,”