The evidence that it is obligatory is the verse in which Allah says (interpretation of the meaning): “There is no sin on you if you seek the Bounty of your Lord (during pilgrimage by trading, etc.). Then when you leave Arafat, remember Allah (by glorifying His Praises, i.e. prayers and invocations, etc.) at the Mashar-il-Haram. And remember Him (by invoking Allah for all good, etc.) as He has guided you, and verily, you were, before, of those who were astray” [al-Baqarah 2:198].
The basic principle with regard to commands is that they are obligatory unless there is evidence to indicate otherwise. And because the Prophet (blessings and peace of Allah be upon him) said to ‘Urwah ibn Mudarris (may Allah be pleased with him), when he met him at Fajr prayer on the day of Muzdalifah, when he said: O Messenger of Allah, I have worn myself out and I have exhausted my camel; there is no hill on which I did not stand. The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever attended this prayer of ours and stood with us until we moved on, and stood in ‘Arafah before that, by night or day, has completed his Hajj and completed his rituals.”
And because the Prophet (blessings and peace of Allah be upon him) granted a concession to the weak allowing them to move on from Muzdalifah at the end of the night, and the concession indicates that the original principle is that it was a duty and a must. In fact some of the scholars are of the view that stopping in Muzdalifah is one of the pillars or essential parts of Hajj, because Allah, may He be exalted, enjoined it in the verse in which He said (interpretation of the meaning):
“Whoever attended this prayer of ours and stood with us until we moved on, and stood in ‘Arafah before that, by night or day, has completed his Hajj and completed his rituals”
And the Prophet (blessings and peace of Allah be upon him) adhered to that and said: “I have stopped here, and all of Jam‘ – i.e. Muzdalifah – is a place of stopping.” Narrated by Muslim. But the moderate scholarly view is that staying overnight in Muzdalifah is obligatory but is not an essential part or pillar and is not a Sunnah. End quote.
Majmoo‘ Fataawa Ibn ‘Uthaymeen, 23/52.