Praise be to Allah.
Shaykh Ibn Baaz said:
If he could not find any place in Muzdalifah or if the soldiers prevented him from stopping there, then he does not have to do anything, because Allaah says (interpretation of the meaning):
“So keep your duty to Allaah and fear Him as much as you can”
But if that was because he took the matter lightly, then he has to offer a sacrifice and repent.