Whoever does not find any space in Mina should spend the night close to it
Question

                If a pilgrim does not find any space in Mina, is it acceptable for him to spend the night outside Mina?
Praise be to Allah.There is no blame on him if he spends the night outside Mina, but the place where he camps should be connected to the pilgrim camps, because Allah, may He be exalted, says (interpretation of the meaning):
“So fear Allah as much as you are able”
[at-Taghaabun 64:16]
“and [Allah] has not placed upon you in the religion any difficulty”
[al-Hajj 22:78]
“Allah intends for you ease and does not intend for you hardship”
[al-Baqarah 2:185].
But the place where he camps should be connected to the pilgrim camps, similar to the case of the congregation if the mosque is full; they should form a row where the last of the rows ends, and they will come under the same ruling as those who are praying inside the mosque. End quote.
Majmoo‘ Fataawa Ibn ‘Uthaymeen (23/240)