These verse were revealed in Makkah (Mecca). Dr. Muhammad Asad:
“The Forty-Second Surah Ash-Shura (Consultation) Mecca Period:
THE BEGINNING and the end of this surah stress the reality of divine revelation, and the fact that all prophets, at all times, preached one and the same essential truth – namely, the existence and oneness of God – and the same ethical principles:
Either of which makes it imperative that all believers in the One God, whatever their historical “denomination”, should regard themselves as “one single community” (see verse 13 and the corresponding note 14, as well as verse 15).
Hence, all divisive speculations about the “nature” of God are “null and void in their Sustainer’s sight” (verse 16), because “there is nothing like unto Him” (verse 11), and, therefore, nothing by which to define Him. And because God is undefinable and unfathomable, man cannot grasp even the real nature of His activity beyond the fact that He has imposed on all creation the law of cause and effect – so that in the life to come man will only harvest “what his own hands have wrought” in this world.
The key-word by which this surah has always been designated is derived from the phrase shura baynahum (“consultation among themselves”) in verse 36, outlining one of the basic social principles which ought to characterize the community of true believers. 
42:39 And those who, when tyranny strikes them, they defend themselves,
42:40 And the retribution for an evil act is an evil one like it, but whoever pardons and makes reconciliation – his reward is [due] from Allah . Indeed, He does not like wrongdoers.
42:41 And whoever avenges himself after having been wronged – those have not upon them any cause [for blame].
40:42 The cause is only against the ones who wrong the people and tyrannize upon the earth without right. Those will have a painful punishment.
40:43 And whoever is patient and forgives – indeed, that is of the matters [requiring] determination.
42:39 – Human beings who suffer aggression, injustice and tyranny, they will defend themselves.
42:40 – For the requital of an evil action is similar like it. If those are wronged forgive their perpetrators they will be rewarded immensely by God. God prefers one to forgive their aggressor(s).
42:41 – If those who were wronged, were to retaliate defending themselves, God says there is no blame on them for this.
42:42 – Those people who indulge in harming, terrorizing and doing injustice to innocents – God will punish them in the hereafter and bring them to account for that (Tafsir Ibn Kathir).
42:43 – Here in the verse, as we explained previously, if those who were wronged, were to forgive those who harmed them, they would be rewarded much by God.
Sayyid Abul Ala Maududi:
“63 This also is one of the best characteristics of the believers: they do not fall a prey to the tyrants. Their tender heartedness and forgiving nature is not the result of any weakness. They have not been taught to live humbly and meekly like the hermits and ascetics.
Their nobility demands that when they are victors they should forgive the errors of the vanquished; when they possess the power, they should avoid vengefulness and when a weak or subdued person happens to commit a mistake they should overlook it;
But when a powerful person, drunk with authority, commits violence against them, they should resist and fight him with all their might. A believer is never cowed by a wicked person nor bows to an arrogant man. For such people he proves to be a hard nut which breaks the teeth of those who try to break it.
64 The passage from here to the end of verse 43 is an explanation of verse 39.
65 This is the first fundamental principle which must be borne in mind in retaliation. The right limit of retaliation is that one should return the same sort of ill treatment that one has received; one has no right to return a greater ill treatment.
66 This is the second principle. It means: Although it is permissible to retaliate against the one who has committed a violence, wherever pardoning can be conducive to reconcilement, pardoning is better for the sake of reconcilement than retaliation. And since man pardons the other by suppressing his own feelings, Allah says that the reward of such a one is with Him, for he has suppressed his own self for the sake of reforming the evil-doers.
67 In this warning allusion has been made to a third principle about retaliation, and it is this: One should not become a wrongdoer oneself in the process of avenging a wrong done by the other. It is not permissible to do a greater wrong in retaliation for the wrong done.
For example, if a person gives another a slap, the other can return only one slap; he cannot shower blows and kicks. Likewise, it is not right to commit a sin in retaliation for a sin. For example, if a wicked man has killed the son of someone, it is not right to go and kill the son of the former.
Or, if a mean person has violated the chastity of a person’s sister or daughter, it is not lawful for him to commit rape on the former’s sister or daughter.
68 One should note that the qualities of the believers that have been mentioned in these verses, practically existed in the lives of the Holy Prophet and his Companions, and the disbelievers of Makkah were their eye-witnesses. Thus, Allah has, in fact, told the disbelievers:
“The real wealth is not the provisions that you have received for passing the transitory life of the world, and are bursting with pride of it, but the real wealth are the morals and characteristics which the believers from your own society have developed by accepting the guidance given by the Qur’an.” (Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an – online source)
Tafsir Ibn Kathir:
“(And those who, when an oppressive wrong is done to them, take revenge.) a means, they have the strength to take revenge on those who commit aggressive wrong and hostile acts against them. They are not incapable of doing so and they are not helpless; they are able to take revenge against those who transgress against them,
Even though when they have the power to take revenge, they prefer to forgive, as when Yusuf, peace be upon him, said to his brothers:
(No reproach on you this day; may Allah forgive you) (12: 92). Even though he was in a position to take revenge on them for what they had done to him.
The Messenger of Allah forgave the eighty people who intended to do him harm during the year of Al-Hudaybiyah, camping by the mountain of At-Tan`im. When he overpowered them, he set them free, even though he was in a position to take revenge on them. He also forgave Ghawrath bin Al-Harith who wanted to kill him and unsheathed his sword while he was sleeping.
The Prophet woke up to find him pointing the sword at him. He reproached him angrily and the sword dropped. Then the Messenger of Allah picked up the sword and called his Companions He told them what had happened, and he forgave the man. There are many similar Hadiths and reports. And Allah knows best. (The recompense for an evil is an evil like thereof).
This is like the Ayat: (Then whoever transgresses the prohibition against you, you transgress likewise against him) (2:194), and (And if you punish, then punish them with the like of that with which you were afflicted) (16:126). Justice, has been prescribed, in the form of the prescribed laws of equality in punishment (Al-Qisas),
But the better way, which means forgiving, is recommended, as Allah says: (and wounds equal for equal. But if anyone remits the retaliation by way of charity, it shall be for him an expiation) (5:45). Allah says here: (but whoever forgives and makes reconciliation, his reward is with Allah.) means, that will not be wasted with Allah. As it says in a Sahih Hadith:
(Allah does not increase the person who forgives except in honor.)” (Verily, He likes not the wrongdoers.) means, the aggressors, i.e., those who initiate the evil actions. (And indeed whosoever takes revenge after he has suffered wrong, for such there is no way (of blame) against them.) means, there is no sin on him for taking revenge against the one who wronged him.
(The way) means, the burden of sin, (is only against those who oppress men and rebel in the earth without justification;) means, those who initiate wrongful actions against others, as it says in the Sahih Hadith:
(When two persons indulge in abusing each other, the one who initiated the wrongful action is to blame, unless the one who was wronged oversteps the mark in retaliation.) (for such there will be a painful torment.) means, intense and agonizing.
It was reported that Muhammad bin Wasi` said, “I came to Makkah and there was a security out post over the trench whose guards took me to Marwan bin Al-Muhallab, who was the governor of Basrah. He said, `What do you need, O Abu `Abdullah’ I said, `If you can do it, I need you to be like the brother of Banu `Adiy.’
He said, `Who is the brother of Banu `Adiy’ He said, `Al-`Ala’ bin Ziyad; he once appointed a friend of his to a position of authority, and he wrote to him: If you can, only go to sleep after you make sure that there is nothing on your back ﴿i.e., you do not owe anything to anyone﴾, your stomach is empty and your hands are untainted by the blood or wealth of the Muslims.
If you do that, then there will be no way (of blame) against you — (The way is only against those who oppress men and rebel in the earth without justification; for such there will be a painful torment.)’ Marwan said, `He spoke the truth, by Allah, and gave sincere advice. ‘ Then he said, `What do you need, O Abu `Abdullah’ I said, `I need you to let me join my family.’ He said, `Yes ﴿I will do that﴾.”’ This was recorded by Ibn Abi Hatim.
When Allah condemned wrongdoing and the people who do it, and prescribed Al-Qisas, He encouraged forgiveness: (And verily, whosoever shows patience and forgives,) meaning, whoever bears the insult with patience and conceals the evil action, (that would truly be from the things recommended by Allah.) Sa`id bin Jubayr said, “This means, one of the things enjoined by Allah,” i.e., good actions for which there will be a great reward and much praise. (Tafsir Ibn Kathir online source)
Dr. Muhammad Asad:
“40 Lit., “is [or “may be”] an evil like it”. In other words, successful struggle against tyranny (which latter is the meaning of the noun baghy in the last sentence of the preceding verse) often tends to degenerate into a similarly tyrannical attitude towards the erstwhile oppressors,
Hence, most of the classical commentators (e.g., Baghawi, Zamakhshari, Razi, Baydawi) stress the absolute prohibition of “going beyond what is right” (i’tida’) when defending oneself against tyranny and oppression. (Cf. the passage relating to fighting against “those who wage war again you” in 2:190 ff.)
41 I.e., in this context, such as succumb to the temptation of indulging in undue acts of revenge against their former oppressors.
42 Cf. 41:34-35, as well as note 44 on 13:22.
43 See note 4 on 14:4.
44 Although this is primarily a reference to “those who oppress [other] people and behave outrageously on earth, offending against all right” (verse 42 above), the meaning of the term is general, applying to all kinds of deliberate evildoers. 45 I.e., a “second chance” on earth: cf. 6:27-28.” 
Malik Ghulam Farid:
“2661. The verse forms the basis of the penal laws of Islam. The real object underlying the awarding of punishment to the guilty person according to Islamic teaching, is his moral reformation. If forgiveness is calculated to do him some moral good, he should be forgiven.
But he should be punished, if permission is likely to lead to his reformation; the punishment, however, should in no case be disproportionate to the offence committed. Islam does not believe in the monastic teaching of turning the other check, nor in the Jewish doctrine of ‘an eye for an eye,’ under all conditions. It adopts the golden mean.
2662. Islamic principles about punishing an offender may not appeal to visionaries and unpractical idealists, but as a practical religion, Islam has laid down most wholesome and practical solutions for problems of law, economics and morals. It regards self-defence as the moral duty of a Muslim. The Holy Prophet is reported to have said, ‘He who is killed in defence of his property and honour is martyr’ (Bukhari, Kitab al-Mazalim Wa’l-Ghasab).” 
Maulana Muhammad Ali:
“39a. Intasara alone signifies he defended himself against his injurer (LL); followed by min, it signifies the taking of revenge. The first meaning is applicable here, as it is not followed by min.
40a. A golden rule relating to forgiveness of evil is given here. The rule laid down is that evil must be requited by punishment proportionate thereto. Note that punishment which is meted out for an evil is called a sayyi‘ah or an evil, because the Arabs speak of the requital of an evil in terms of that evil; see 2:15a.
Also note that the punishment must be proportionate to the evil. A very just and necessary restriction. And this beautiful maxim is given by a man whose people were in the habit of slaughtering whole tribes for the most trifling fault of one member.
Again, forgiveness is not neglected, nor preached in such a manner as to make it impracticable. There is in Islam neither the one extreme of tooth for tooth or the opposite one of turning the left cheek when the right is smitten or giving away the cloak to one who has already wrongfully taken the coat of his brother;
it is the golden and beautiful mean that forgiveness may be exercised, if forgiveness will mend the matter and do good to the wrongdoer himself. The object to be kept in view is to amend, whether it is attained by giving proportionate punishment or by exercising forgiveness.” 
Shaykh Ashiq Ilahi Madni:
“WHATEVER YOU HAVE ARE ARTICLES OF THE WORLDY EXISTENCE, WHILE THAT WHICH IS WITH ALLAH SHALL BE FOR THOSE WHO BELIEVE AND TRUST IN HIM
Describing the ephemeral nature of this world and the permanence of the hereafter, Allah says, ‘whatever you have been given is merely an article of this worldly life. What is with Allah is better and more lasting for those who believe in and trust their Lord…’ Allah then describes the attributes of the believers, when He says that they:
1. ‘trust their Lord’
2. ‘abstain from major sins, immorality.’
3. ‘Pardon when they are angry.’
4. ‘respond to (the command of) their Lord.’
5. ‘who establish Salah (in the proper manner).’
6. ‘Whose affairs (are decided) by mutual consultation between themselves.’
7. ‘who spend from what We have provided for them.’
8. ‘Who retaliate when oppression affects them.’ They retaliate only to the extent of the oppression perpetrates against them – not more.
These are salient qualities of a believer, which he should DISPLAY AT ALL TIMES ON ALL OCCASSIONS.
‘whatever you have been given is merely an article (asset) of this worldly life.’ This verse tells us that the commodities of this world are of benefit to one and all, be they believers or disbelievers.
This verse also denotes that the things of this world are limited to this world, and will not proceed into the Hereafter. Of course, if they are utilised to procure rewards in Hereafter, the benefit will extend there as well.
‘And those who retaliate when oppression affects them.’ This verse denotes that it will be permissible for an oppressed person to avenge the injustice done to him. Naturally, the retaliation should not exceed the damage done. …
PROPORTIONATE REVENGE MAY BE TAKEN, AND THE REWARD FOR PARDONING LIES WITH ALLAH
The previous verse read:
‘And those who retaliate when oppression accts them.’ Since this verse does not provide details about the limits of retaliation, Allah adds the details to the above verses. Allah says, ‘The retribution for an evil is a proportionate response.’ A wronged person may retaliate only to the extent of the wrong done to one. If the retaliation exceeds the extent of the wrong, the person retaliating will then be guilty of injustice.
‘As for the one who pardons and makes amends, his reward will be with Allah.’ Although it is permissible to take revenge, it will be best to pardon the aggressor. This pardon will not be in vain because Allah will amply reward a person for this. If a person chooses not to pardon, he himself should not oppress in turn because ‘Verily, Allah does not like the oppressors.’
‘There will be no blame on the one who takes revenge after he has been wronged.’ When, ‘within limits, a person takes revenge for a wrong done to him, he cannot be condemned because he merely exercised his right. If the aggressor or the aggressor’s family wish to retaliate, they will be guilty of oppression.
Concerning them, Allah says, ‘There will be blame only on those who oppress people and unjustly rebel on earth. An excruciating punishment shall be the lot of these people.’
Thereafter, Allah proclaims, ‘Whoever exercises patience and pardons, this is certainly among the most resolute matters.’ While everybody does not have the capacity to do this, it should be borne in mind that the reward is extremely great. Sayyidina Abu Hurayrah reports from the Holy Prophet that Sayyidina Musa once asked Allah who is most honourable in His sight. Allah replied, ‘The person who pardons despite possessing the ability to retaliate.’ [Mishkat p. 434]” 
 The Message of The Quran translated and explained by Muhammad Asad, page 1017
 The Message of The Quran translated and explained by Muhammad Asad, page 1027 – 1028
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid, page 980
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction by Maulana Muhammad Ali, Page 950
 Illuminating Discourses on the Noble Quran – Tafseer Anwarul Bayan – By Shaykh Ashiq Ilahi Madni, volume 4, page 503 – 504