Spending three or two nights, the 11th and 12th of Dhul-Hijjah, at Mina is wajib (requisite), according to Malik, Ash-Shafi`i and Ibn Hanbal. The Hanafi school regards sleeping at Mina as a Sunnah only.
In this regard, we will cite what Sheikh Sayyed Sabiq states in his well-known book, Fiqh As-Sunnah: “Spending three nights or two nights, the 11th and 12th of Dhul-Hijjah, at Mina is wajib (requisite) according to Malik, Ash-Shafi`i and Ibn Hanbal. The Hanafi school regards sleeping at Mina as a Sunnah only.
Ibn `Abbas said, “After you have thrown the pebbles you may spend the night wherever you wish.” This is reported by Ibn Shaibah. Mujahid said, “There is no harm if one spends the first portion of the night at Makkah, and the last one at Mina, or the first portion of the night at Mina and the last one at Makkah.” Ibn Hazm said, “A pilgrim who does not spend the night at Mina does wrong, but he does not incur any penalty.” There is consensus that in the case of those who have a genuine excuse like water carriers, and shepherds, sleeping the night at Mina is not necessary, and if they leave out anything they do not incur any penalty.
The uncle of the Prophet (peace and blessings be upon him), Al-`Abbas, sought and got permission from the Prophet (peace and blessings be upon him) to spend these nights (supposed to be spent in Mina) at Makkah, so that he could attend to his job as provider of drinking water for the pilgrims. (Al-Bukhari and others). `Asim ibn `Adi reported that the Prophet (peace and blessings be upon him) excused the shepherds from sleeping at Mina.”