Praise be to Allah, the Lord of the Worlds.
Combining two prayers-due to travel or rain-is governed by several conditions; the most important of which is performing the combined prayers incessantly for this is what the Prophet (PBUH) used to do.
Ibn Hajar al-Haithami (May Allah have mercy on him) said: "When combining two prayers, it is conditioned that they are performed incessantly, because it was reported that the Prophet (PBUH) had done so, and this is why Al Sunnan Al Rawatib (Sunnah Prayers associated with Fardh prayer) aren`t offered between the two. However, if the interval between these two prayers was long due to an excuse, such as insanity, then the second prayer must be delayed until its due time. Nonetheless, there is no harm in case that interval was short as its length is determined by customary practice since there is no evidence from Sharia governing that." {Raad al-Mohtaaj, vol.2/pp.397}.
Later scholars have clarified that a short interval is equal to the time a person needs to offer two light Rakahs along with ablution, Iqamah and Athan. Nowadays, we estimate it at seven minutes, and more than that is considered long. However, if the praying person had doubts about whether that interval was short or long, then it isn`t permissible for him to combine these two prayers; as reported in {Moghni al-Mohtajj, vol.2/pp.276}."
In conclusion, if the person who had offered the Duhr prayer left the Masjid for no more than five minutes, then returned and caught the Asr prayer with the congregation, then his combining of these two prayers is valid and his prayers are valid as well and will avail him Insha`allah. And Allah Knows Best.