Shaykh ‘Aadil bin Yoosuf
al-Azzaazee wrote:
If a person forgot a prayer
whilst travelling then he remembered it while on another journey, he should
offer it in the shortened form; and if he remembered it when he is at home, he
should shorten it according to the most correct view.
If he misses a prayer when he
is at home then he remembered it whilst travelling, he should perform the
prayer in the complete form and vice versa: that is to say, consideration
should be given to the state it was enjoined upon him and not the state of performing
it. There is difference of opinion on this issue, but what we have mentioned is
the most correct opinion.
If the time of prayer started
whilst he is in his town, then he travelled, he should shorten his prayer, and
vice versa: if the time of prayer started whilst he is travelling, then he
reached his town, he should offer it in the complete form considering the state
of performing the prayer.
Source: See Tamaamul-Minnah fee Fiqh al-Kitaab wa Saheeh as-Sunnah, vol. 1, p. 447-448 by Shaykh ‘Aadil bin Yoosuf al-Azzaazee, translated by Abdus-Samee’ Abdus-Salaam.