Overall meaning :
The Almighty says, pointing out the bad consequences of those who do not show gratitude to Him for His blessings and deny His signs: Allah strikes out the parable of a city which was secure and at ease, with its provision coming to it in abundance from all quarters. But then its people denied Allah’s favours and worshipped others besides Him; therefore, Allah afflicted them with famine and fear as punishment for their unbelief and misdeeds. Allah did send a messenger to them from among them, whose lineage, truthfulness and trustworthiness they knew very well, calling them to the truth; but they disbelieved him, and so Allah made them taste the misery of killing, hunger and fear while they were still wrongdoers—worshipping others besides Him.
The Almighty then enjoins His servants to eat of the lawful and good things that He has bestowed on them and to be grateful for His favours: Eat, then, of the lawful, good things which Allah has provided for you as sustenance, and render thanks to Allah for His blessings by using them as a means of showing obedience to Him, if it is truly Him alone that you worship.
Next, He mentions what He has forbidden them: He only forbids you to eat the flesh of animals that die of themselves (that is, without being slaughtered in accordance with Islamic law or killed in a hunt), running, outpoured blood of animals when they are being slaughtered, the flesh of pigs and sacrificial animals over which any name other than Allah’s is invoked upon slaughtering them (such as those sacrificed to idols). However, if someone is compelled by necessity—neither driven by desire nor exceeding immediate need—then surely Allah will not punish him for doing so, for Allah is All-Forgiving, Most Merciful.
Almighty Allah then warns the idolaters, who associate partners with Him and worship them besides Him, against saying anything about Him without any knowledge: Do not falsely declare with your tongues, ‘This is lawful,’ for whatever Allah has prohibited and ‘that is forbidden,’ for whatever He has permitted, thus fabricating lies and attributing them to Allah. Those who falsely attribute lies to Allah will not succeed or gain any good in this life or in the hereafter. Brief is their enjoyment in this life, but they will suffer a painful punishment in the life to come.
After that, He states that He only forbade the Jews certain wholesome things because of their wrongdoing: We forbade the Jews what We have mentioned to you, Muhammad, before in Surat Al-An’am (Surah 6 – Grazing Livestock). We did not wrong them by forbidding them such things, but it was they who persistently wronged themselves by disobeying Allah’s commands, and so they rightly deserved the punishment meted out to them.
The Almighty then reveals His immense mercy and great compassion towards His servants: To those who commit sins in ignorance of their consequences, and then repent of their sins, turn to Allah and mend their ways, your Lord is All-Forgiving and All-Compassionate towards them.