Nafi reported,

Abdullah bin Umar used to say, "If someone forgets a prayer and does not remember it until he is praying with the imam, then once the imam has given the closing salutation he should pray the prayer he forgot, and afterwards pray the other one."

Malik 417

Sahih

و حدثني عن مالك

عن نافع

أن عبد الله بن عمر كان يقول من نسي صلاة فلم يذكرها إلا وهو مع الإمام فإذا سلم الإمام فليصل الصلاة التي نسي ثم ليصل بعدها الأخرى

مالك 417صحيح
Contents
Reference
Commentary
Ayat
Collection
Muwatta Malik
Book
Shortening prayer while traveling
Numbering
Laithi 417
Malik 417