The night at Muzdalifah is part of the Hajj journey, and the Sunnah is to pray Maghrib and Isha combined and shortened (qasr) upon arrival from Arafat, then rest until shortly before Fajr. If a pilgrim falls asleep and misses the combined Maghrib and Isha prayers, they must pray them as soon as they wake up, because the Prophet (peace be upon him) said: 'Whoever sleeps through a prayer or forgets it, let him pray it when he remembers it, for that is its time.' Prayer is never waived due to sleep or forgetfulness.
Regarding the stay itself at Muzdalifah, the majority of scholars (Hanafi, Maliki, Shafi'i) consider it wajib (obligatory). The Hanbali school considers it a rukn (pillar) of Hajj according to one opinion, though the well-known position is that it is wajib. Sheikh Ibn Baz held that the stay at Muzdalifah is wajib, and missing it without a valid excuse requires a dam (sacrifice). If a pilgrim was present at Muzdalifah even briefly during the night or before Fajr, they have fulfilled the requirement.
Sheikh Ibn Uthaymeen clarified that if a pilgrim arrived at Muzdalifah, fell asleep, and woke up after Fajr having missed the entire nighttime supplication and the Fajr prayer at Muzdalifah, they should pray what they missed immediately. Their Hajj is valid because they were physically present at Muzdalifah. However, they missed the Sunnah of the lengthy supplication after Fajr at Mash'ar al-Haram. The stay itself was fulfilled by their physical presence during the night, even while sleeping.