إِنَّمَا حَرَّمَ عَلَيْكُمُ ٱلْمَيْتَةَ وَٱلدَّمَ وَلَحْمَ ٱلْخِنزِيرِ وَمَآ أُهِلَّ بِهِۦ لِغَيْرِ ٱللَّهِ فَمَنِ ٱضْطُرَّ غَيْرَ بَاغٍ وَلَا عَادٍ فَلَآ إِثْمَ عَلَيْهِ إِنَّ ٱللَّهَ غَفُورٌ رَّحِيمٌ ١٧٣
He has only forbidden to you dead animals, blood, the flesh of swine, and that which has been dedicated to other than Allāh. But whoever is forced [by necessity], neither desiring [it] nor transgressing [its limit], there is no sin upon him. Indeed, Allāh is Forgiving and Merciful.
Explanation: Al-Mukhtasar
Allah has only forbidden you from consuming that which died without being sacrificed according to the sacred law and having its blood flow, the meat of pigs and what has had other than Allah’s name mentioned over it when it was sacrificed. Yet if someone is forced to eat something of these forbidden types, and does not sin by eating it when they are not in need, nor do they go beyond the limit of what is necessary, then they have done no wrong and will receive no punishment. Allah is Forgiving and Compassionate to whomever repents to Him; and it is from His mercy that He overlooks the eating of forbidden things when it is necessary.