Answer
Wa `alaykum As-Salamu waRahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Scholars have ruled that it is not essential to spend the entire night in Muzdalifah; rather, it is enough to spend part of the night or any time after midnight.
In responding to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
Ideally, we should spend the night in Muzdalifah on our way from Arafah after sundown. We should pray Maghrib and Isha combined, and then retire until Fajr, and spend time in dhikr until the light of dawn spreads. It is the Sunnah of the Prophet (peace be upon him); he is said, “Learn your hajj rites from me.” (Muslim)
However, he allowed those with valid excuses such as women, elderly as well as others with reasonable excuses to leave after midnight to head to Mina for pelting before the crowd arrives.
Based on this, scholars have ruled that it is not essential to spend the entire night in Muzdalifah; rather, it is enough to spend part of the night or any time after midnight.
Imam Malik is the most flexible on this as he says: One may spend as much as required to halt for a rest and recuperate; some scholars have calculated this to be something like half an hour if not more.
We are allowed to follow this conception when faced with unavoidable circumstances or hardship. The Prophet showed on more than one occasion that there is much latitude in the performance of Hajj rites where there is a hardship.
Allah Almighty knows best.