He did sujood al-tilaawah with the imam at the back of the mosque, then he came forward and joined the prayer
Question

                A man entered the mosque – which was a large mosque – when the imam was reciting, and when the imam reached a verse in which a prostration is required (sujood al-tilaawah), he prostrated. The man thought that if he went and joined the row he would not catch up with that prostration with the imam, so he prostrated while he was still in the back of the mosque, then he stood up from the prostration and reached the row and joined the prayer with the imam. Is what that man did correct?.
Praise be to Allah.
    That is not prescribed in sharee’ah, unless he was listening 
    to the recitation purposefully, in which case he could prostrate with the 
    imam even though he was not praying behind him. But if his intention was to 
    join the imam and pray behind him, then what he did was an invalid action.