The night at Muzdelife is part of the Hac 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 haci falls asleep and misses the combined Maghrib and Isha namazs, they must pray them as soon as they wake up, because Hz. Peygamber (sallallahu aleyhi ve sellem) said: 'Whoever sleeps through a namaz 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 Muzdelife, the majority of scholars (Hanafi, Maliki, Shafi'i) consider it wajib (farz). The Hanbali school considers it a rukn (pillar) of Hac according to one opinion, though the well-known position is that it is wajib. Sheikh Ibn Baz held that the stay at Muzdelife is wajib, and missing it without a valid excuse requires a dam (sacrifice). If a haci was present at Muzdelife even briefly during the night or before Fajr, they have fulfilled the requirement.
Sheikh Ibn Uthaymeen clarified that if a haci arrived at Muzdelife, fell asleep, and woke up after Fajr having missed the entire nighttime dua and the Fajr namaz at Muzdelife, they should pray what they missed immediately. Their Hac is valid because they were physically present at Muzdelife. However, they missed the Sunnah of the lengthy dua after Fajr at Mash'ar al-Haram. The stay itself was fulfilled by their physical presence during the night, even while sleeping.