بسم الله الرحمن الرحيم
Q: The traveler who seeks to take lodging with a people during his journey yet (while doing so) finds them praying Asr and they have already completed the first two rakat, as a result he enters (catches) the last two. So should he make the tasleem (along with them having only prayed two rakat) or should he complete the full prayer (standing up and praying two more rakat)?
A: He completes it (all four). The traveler whenever he prays along with the residents of a locality his prayer is the same as theirs, whatever he reaches he prays and whatever he missed he completes.
Translated by Najeeb Al Anjelesi
Source: http://lohaidan.af.org.sa/node/222