Reference: I’laam al-Mu’aasireen bi-Fataawa Ibn ‘Uthaymeen – Page 47
Question: The imaam led the Maghrib prayer and during the prayer he remembered he had not prayed the ‘Asr prayer, so what should he do?
Response: This imaam, who forgot the ‘Asr prayer and began the Maghrib prayer and thereafter remembered during the prayer he had not prayed [the] ‘Asr [prayer] should continue with the Maghrib prayer. Upon completing the [Maghrib] prayer he should [then] perform the ‘Asr prayer and in this situation his ‘Asr prayer will be correct.
This ruling is general, even if one was praying alone, because if a person begins an obligatory prayer then he is required to complete it unless he has an Islaamically acceptable reason not to do so.