What Should One Who Finds The Imam In Prostration Do ? Sunan Abi Dawud 893
Translation
When you come to the prayer while we are prostrating, then prostrate yourselves, and do not count it as anything; and whoever catches the rak'ah has caught the prayer.