Staying overnight in Mina on the night before the eleventh and the night before the twelfth of Dhu'l-Hijjah is obligatory according to the correct opinion. Its being obligatory is indicated by the fact that when al-Abbaas (may Allah be pleased with him) wanted to go to Makkah to draw water for the pilgrims, the Prophet (blessings and peace of Allah be upon him) granted him a concession allowing him to do so.
The scholars said that the words granted him a concession indicate that the original principle is that it is obligatory, because a concession cannot be granted except in the case of something that is (ordinarily) obligatory. So what people have to do is look for a place in Mina before halting in Muzdalifah; if he cannot find a place then he should halt in Muzdalifah and stay there, and he does not have to go to Mina and drive around in his car for most of the night, or sit on the street between the cars, which may be dangerous for him. So we say: If you could not find a place in Mina, then stay in Muzdalifah, where the tents end, and you do not have to do anything so long as you looked for a place and could not find any, because Allah does not burden any soul beyond its scope. End quote.
Reproduced from Islam QA