We have explained that if one forgets to pray a given prayer, one must compensate for it immediately following the next prayer by praying the Amida prayer once again. This is referred to as the compensatory prayer.
Which Prayer Comes First
When one wishes to pray a compensatory prayer, one must first recite the prayer appropriate for that time and only afterwards to recite the Amida again as a compensatory prayer. Thus, if one has forgotten to pray Shacharit and is praying Mincha twice, one should intend for the first Amida prayer to be one’s Mincha prayer and the second Amida as compensation for Shacharit.
If one switched the order of the Amida prayers, even if this was only in one’s thoughts (as opposed to verbally exclaiming so) and even if one did so inadvertently, one has not fulfilled his obligation of reciting a compensatory prayer for Shacharit and one must pray a third time to properly compensate for Shacharit.
Nevertheless, if one has only switched their order mentally, before beginning to pray a third time, it is preferably that one stipulate a donated/voluntary prayer by thinking as follows: “If I am obligated to pray again, the following prayer should be for the obligation of my prayer and if I am not obligated to pray again, the following prayer should be considered a donated/voluntary prayer.” If one has prayed twice one after another without having specific intention regarding which one is the current obligatory prayer and which is the compensatory prayer, one has nevertheless fulfilled one’s obligation.
Although we have written in the previous Halacha that one should not recite voluntary prayers nowadays, nevertheless, when there is a great need to do so, such as in our scenario, one may recite such a prayer while stipulating a voluntary prayer.
Summary: One who has forgotten to pray a certain prayer or was unable to do so because of a situation beyond one’s control must compensate for that prayer. The proper procedure for this is, as follows: If the prayer one has missed is Shacharit, immediately upon concluding Mincha prayers, one should then immediately recite the Amida prayer once again as compensation for the missed Shacharit prayer. One must have in mind that the first Amida is for Mincha prayers and the second Amida is compensation for the missed Shacharit.
The same applies if one has forgotten to pray Mincha in that after the Arvit Amida, one should immediately recite the Amida prayer again as compensation for Mincha. The same applies to the other prayers as well.