Note that my answer here could also be helpful to some extent as it refers to these verses.
Let's start with the Verse 22:39, :
أذن للذين يقاتلون بأنهم ظلموا وإن الله على نصرهم لقدير
Some of the accepted readings are:
I'm quoting them for this Verse only as I've already started with that in my comments, but now had the time to check reliable sources, instead of answering based on something I had in my mind, if necessary i would quote the different readings for the other verse too
أُذِنَ udhina (meaning: Permission has been given) which is the reading of Nafi', Abu 'Amr and 'Assim the others have read it أَذِنَ adhina (meaning: He gave permission).
يُقَاتَلُونَ yoqataluna (meaning: those who are being fought (by the non-Believers while -or because- they are believers) -> passive form) which is the reading of Nafi', ibn 'Amir, Abu Jaafar and Hafs 'an 'Asim. While the others have read it يُقَاتِلُونَ yoqatlinu (meaning: those who are fighting (their enemies) -> active form).
Note that this verse is referring to verse 22:38:
Indeed, Allah defends those who have believed. Indeed, Allah does not like everyone treacherous and ungrateful.
one could say it's a response or an implication explaining the way Allah defends the believers, by allowing them to fight the non-believers as an act of self-defense or for the justness of the cause.
This is the main meaning which we can extract from the related ahadith like this one from Jami' at-Tirmdihi which is explaining the circumstances of this revelation. The hadith is also quoted in sunan an-Nasa-i.
As stated in my comments the different readings imply different explanations, but Imam al-Qurtoby in his tafsir based on the first reading (I'm referring to يقاتلون as this is the word which has two more or less opposite meanings according the readings) say that the reason for fighting is that they have been wronged, so it refers to self defense in first place.
Verse 22:40 is explaining how they have been wronged:
They have been expelled from their homes -only because they believed-.
Ibn al-'Arabi said (according to al-Qurtoby) that before the bay'a of al-'Aqabah Muhammad (peace be upon him) was not allowed to fight the disbelievers, but asked to make du'a and bear the bane and pardon for ten years. So that a clear plea for there wrong doings even after sending a Messenger to them with a clear shari'a:
... And never would We punish until We sent a messenger. (17:15)
So the fighting -in this case- could also be understood as a divine punishment for Quraish.
In addition to that this verse says that only with a shari'a (allowing the fight of disbelievers) disbelievers would come over this world and demolish any place where Allah is worshiped. While if the believers follow the shari'a and they would rule this world the situation would be the total opposite.
Sheikh Taher Benachour added in his tafsir at-tahrir wa-tanwir that this verse certainly has been revealed in Medina.
Note that this verse clearly indicates that demolishing places of worship of Jews and Christians is haram!
Conclusion
Based on the given verses the tafsir al-Ahkam (tafsirs based on juridical rulings) are only speaking about self-defense. But of course one could also conclude that because of the wrong doings Muslims are allowed to fight and define this act as a revenge. But as said in my linked answer Muslims are allowed to fight disbelievers either for self-defense or to prevent an attack of the enemies or for the justness of the cause, but the major goal in all these fighting should be to preserve the Muslim nation!
On the other hand if we speak about retribution in the context of this verse we may mean a divine punishment for Quraish after they have been warned for 10 years by a Prophet!
Note that there are Verses about what we may call revenge, but even this revenge has rules so arbitrary law is not allowed!
And Allah knows best!