The answer to Sharia can be more Sharia.
The Reliance of the Traveller is a desk top Sharia text of great authority. Section c6.0, Dispensation and Strictness (another name for Necessity and Obligation), reads:
c6.2 Dispensation is when what is normally forbidden is made permissible because of a necessity or need.
Also in r32.1 we find: …necessity excuses on from any rule whatever…Section c7.2 also addresses that hardship can mean that an obligatory duty does not need to be performed.
The Arabic term for necessity and obligation is called Darura.