That the necessity removes restriction is an important juridical rule. It shows that the Islamic Shari'ah is not heedless of the exigencies of life, nor to human weakness and our ability to face them; it allows the Muslim, under the compulsion of necessity to do things which would otherwise be prohibited, in order to meet the necessity and save himself from harm.
Necessity means harm. That is, when a person undergoes an excessive situation that could hurt him or destroy his body, part of his body, his mind, his family, his money or his religion.
The prohibited are the things that Allah ordained Muslims not to do, whether these things are disliked or forbidden. This juridical rule is supported by a number of verses in the Qur'an as well as from the Sunnah.
Proofs from the Qur'an
Allah says in the Surah al-Ma'idah:
"Forbidden to you for
food are carrion, blood, swine-flesh, and that which has been dedicated
to any other than Allah; that which was strangled; that which was beaten
to death by a blunt instrument; that which fell a long fall; that which
was gored by horns; that of which predators have eaten - saving that
which you make lawful by slaughtering before they die; and that which
has been sacrificed to idols. And forbidden also is settling matters
with gambling-arrows. That is corruption. This day, those who disbelieve
are in despair of ever stifling your religion; so fear them not, and
fear Me! This day I have perfected your religion for you, and completed
My favour upon you, and chosen Islam for you as religion. Whomever is
forced by hunger, not by will, to sin, for him Allah is Forgiving,
Compassionate." [5:3]
This verse has clearly stated that prohibited food becomes permissible in times of emergency, i.e. extreme hunger.