Praise be to Allah.
If she did not pray Maghrib, and she prayed ‘Isha’ before Maghrib, thinking that the adhaan was for ‘Isha’, and she forgot to pray Maghrib, then she should repeat it; she should pray Maghrib and then repeat ‘Isha’, because she prayed ‘Isha’ at the wrong time, at the time of Maghrib. But if she had prayed Maghrib when the sun set, then her Maghrib prayer was valid, but she had to repeat ‘Isha’ because she prayed it before its time.
Prayer offered at the wrong time is not valid, but if she had not prayed Maghrib, she must make up Maghrib then pray ‘Isha’. End quote.