Praise be to Allah.
The fuqaha’ are agreed that tawaaf al-ifaadah is one of the pillars or essential parts of Hajj, without which it is not complete. However, they differed as to when the time for it begins. The Hanafis and Maalikis are of the view that it begins from dawn on the Day of Sacrifice, and is not valid if done before that.
It says in Badaa’i‘ as-Sanaa’i‘ (2/132) [Hanafi]: With regard to the time for this tawaaf, it begins when the second dawn breaks on the Day of Sacrifice (Yawm an-Nahr), and there is no difference of opinion among our companions concerning that, and it is not permissible to do it before then.
The Shaafa‘is say that the time for it begins half way through the night before the Day of Sacrifice. End quote.
As-Saawi said in Bulghat as-Saalik [Maaliki]: The time for tawaaf al-ifaadah begins from the break of dawn on the Day of Sacrifice, so it is not valid to do it before then, like al-‘Aqabah, i.e., stoning Jamrat al-‘Aqabah, which is not valid if done before then. End quote,
The Shaafa‘is and Hanbalis are of the view that it is valid if it is done after half way through the night before the Day of Sacrifice.
An-Nawawi (may Allah have mercy on him) said [Shaafa‘i]: The time for stoning Jamrat al-‘Aqabah and tawaaf al-ifaadah begins half way through the night before the Day of Sacrifice, on condition that it was preceded by the standing in ‘Arafah.
With regard to shaving the head, if we say that it is a ritual, then its time is the same as the time for stoning the Jamrah and tawaaf,
Otherwise [if we do not regard it as a ritual], the time for it does not begin until one has stoned the Jamrah and done tawaaf.
End quote from al-Majmoo‘ (8/191).
Ibn Qudaamah (may Allah have mercy on him) said [Hanbali]: Hence there are two times for tawaaf, the time that is preferred and the time that is acceptable.
As for the time that is preferred, it is the Day of Sacrifice, after stoning the Jamrah, offering the sacrifice and shaving the head …
As for the time that is acceptable, it begins after half way through the night before the Day of Sacrifice. This is the view of ash-Shaafa‘i.
Abu Haneefah said: The time for it begins with the break of dawn on the Day of Sacrifice, and ends at the end of the days of sacrifice.
End quote from al-Mughni (3/226).
Based on that, if this pilgrim did tawaaf al-ifaadah after half way through the night, his tawaaf is valid according to the Shaafa‘i and Hanbali views.
The halfway point of the night may be determined by working out the time between sunset and dawn, and dividing it in two.
If he did his tawaaf before halfway through the night, then it is not valid, according to scholarly consensus; his Hajj is not complete and he has not completed the second stage of exiting ihram, so he must repeat his tawaaf al-ifaadah.
Staying overnight in Muzdalifah is obligatory according to the majority of scholars; some of them were of the view that it is a pillar or essential part of Hajj.
There is a difference of scholarly opinion as to the length of time that must be spent in Muzdalifah.
According to the Shaafa‘is and Hanbalis, it is obligatory to be in Muzdalifah if only for a brief moment, on condition that that be in the second part of the night after standing in ‘Arafah; it is not stipulated that one remain there, rather it is sufficient to simply pass through it.
If someone departs from Muzdalifah before half way through the night, and comes back to it before dawn, there is nothing wrong with that, because he has done what is required. If he does not come back after the first half of the night, until dawn breaks, then he must offer a compensatory sacrifice, according to the more correct view.
However, according to the Hanafis, it is obligatory to halt in Muzdalifah after dawn beaks, until the sun has risen, and the pilgrim must halt during that time, even for a brief moment. If he refrains from halting there for a valid reason, then there is no blame on him. Valid reasons include being weak or ill, or if a woman is afraid of the crowds.
If he moved on from Muzdalifah before that with no valid reason, then he must offer a compensatory sacrifice.
What appears to be the case is that if he is able to stand there by returning to Muzdalifah before dawn breaks, then the compensatory sacrifice is waived.
According to the Maalikis, halting in Muzdalifah for as long as it takes to dismount and unload one’s luggage – even if one does not actually do that – is obligatory, and if someone does not halt there for as long as it takes to dismount and unload one’s luggage before dawn breaks, then offering a compensatory sacrifice is obligatory for him, unless he has an excuse. If he did not halt there because of a valid excuse, then he does not have to do anything.
End quote from al-Mawsoo‘ah al-Fiqhiyyah (11/108).
Based on that, if this pilgrim did not go to Muzdalifah first, rather he went and did tawaaf al-ifaadah after halfway through the night, then he went back to Muzdalifah and passed through it after halfway through the night, he does not have to do anything.
If he did not go to Muzdalifah after doing tawaaf, because of an excuse that made it permissible for him not to stay overnight there, such as sickness which made him unable to sit in Muzdalifah, then he does not have to offer a compensatory sacrifice.
If he did not go there at all, without any excuse, then he has to offer a compensatory sacrifice.
Al-Khateeb ash-Sharbeeni said in Mughni al-Muhtaaj (2/265): With regard to the one who has an excuse, as we shall see below with regard to staying overnight in Mina, then he definitely does not have to offer a compensatory sacrifice.
Those who have excuses include the one who came to ‘Arafah at night and was preoccupied by standing there.
They also include the one who departed from ‘Arafah and went to Makkah and did tawaaf al-ifaadah, and missed [halting in Muzdalifah].
Al-Adhru’i said: it should be interpreted as referring to the one who was not able to go to Muzdalifah without undue hardship.
The one who is able to do that is obliged to do it, so as to combine two obligatory actions. This is clear.
Another example is if a woman is afraid that menses or nifaas is imminent, so she hastens to go to Makkah and do tawaaf. End quote.
See also: al-Majmoo‘ (8/153).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: What is the ruling on one who does not stay overnight in Muzdalifah?
He replied: The one who does not stay overnight in Muzdalifah has disobeyed Allah and His Messenger, because Allah, may He be exalted, says (interpretation of the meaning): “But when you depart from ‘Arafat, remember Allah at al-Mash‘ar al-Haraam”[al-Baqarah 2:198]. Al-Mash‘ar al-Haraam is Muzdalifah.
If he did not stay there overnight, then he has disobeyed Allah and disobeyed the Messenger (blessings and peace of Allah be upon him) as well, because the Prophet (blessings and peace of Allah be upon him) stayed there overnight, and he said: “Learn from me your rituals (of Hajj).” He did not grant a concession to anyone allowing them not to stay there overnight, except those who were weak, to whom he granted a concession allowing them to move on from Muzdalifah at the end of the night.
According to the scholars, he has to offer a compensatory sacrifice in Makkah and distribute its meat to the poor.
End quote from Majmoo‘ Fataawa ash-Shaykh Ibn ‘Uthaymeen (23/97).
If this pilgrim did tawaaf al-ifaadah, then exited ihram, i.e., he shaved his head or cut his hair, then put on tailored clothes, he does not have to do anything further, because the first stage of exiting ihram comes after doing two of three things: stoning the Jamrah, shaving the head or cutting the hair, and tawaaf. If he had done tawaaf then put on tailored clothes before shaving his head or cutting his hair, then he has committed an action that is prohibited whilst in ihram.
But if he was unaware of that, he does not have to do anything.
The same applies if he put on perfume out of ignorance, thinking that he had exited ihram.
And Allah knows best.