Exegesis on the Quran say these verses were revealed concerning the battle of Uhud (Tafsir Ibn Kathir, Tafsir al-Jalalayn, Tanwir al-Miqbas min Tafsir Ibn ‘Abbas, and Asbab Al-Nuzul by Al-Wahidi).
The battle of Uhud took place as a consequence of the Quraysh losing at battle of Badr. The enemies having lost at Badr, they sought to revenge the loss by coming 100s of miles away from their homes and, start fighting Muslims in Madinah. Hence, the Prophet (p) mobilised his companions to engage the enemy, to defend the city from invasion. The aggression and hostility were started by the Quraysh. These verses below tell the story concerning this incident.
3: 140 If a wound should touch you – there has already touched the [opposing] people a wound similar to it. And these days [of varying conditions] We alternate among the people so that Allah may make evident those who believe and [may] take to Himself from among you martyrs – and Allah does not like the wrongdoers
3: 141 And that Allah may purify the believers [through trials] and destroy the disbelievers.
3:142 And you had certainly wished for martyrdom before you encountered it, and you have [now] seen it [before you] while you were looking on.
The first verse (3:140) tells us that if the Muslims who were at the battle of Uhud, received a wound from a sword, so too have the enemy received similar wound. It goes further that there would be martyr’s among those who fought to defend their lives. The verse ends with saying, that God Almighty does not like the wrongdoers – those who transgress, those who start hostilities.
3:141 doesn’t give us much information other than the fact that God puts believers through trials so to strengthen their beliefs. And through their trials the Muslims living 1400 years ago may destroy those enemies who persecuted, tortured, and murdered Muslims.
In 3:142 God tells us the feelings of some of those Muslims who were in the battle, they were scared and mortified at the chance of going against the Quraysh who came 100s of miles. Some of the Muslim’s inner feelings were that they wished that they died or became martyrs before, rather than engage in this battle defending the Muslim community, 1400 years ago. The words used is indicative that some of them were frightened to stand, and fight the enemy.
“100 Lit., “a wound” (qarh) or, according to some philologists, “pain caused by a wound”.
101 I.e., “His decision to let some of you die as martyrs in His cause is not due to love of the sinful enemies who oppose you, but to His love for you.” The term shuhada’ (pl. of shahid) denotes “witnesses” as well as “martyrs”. The rendering adopted by me comprises both the concepts of “bearing witness to the truth” and of “martyrdom” in God’s cause.
102 Lit., “while God has not yet taken cognizance of those of you who have striven … and those who are patient in adversity”. Since God is all-knowing, His “not taking cognizance” implies, of course, that the thing or happening referred to has not come about or is non-existent (Zamakhshari).
103 In Zamakhshari’s opinion, this is a twofold reproach addressed to the majority of the Companions who took part in the battle of Uhud: firstly, on account of their insistence, against the Prophet’s advice, on giving battle to the enemy in the open field and thereby unnecessarily courting a deadly danger; and, secondly, on account of their failure to live up to their faith during the earlier part of the battle (see note 90 above). This passage may have yet another, more positive implication: namely, a reference to the lesson which the believers should draw from their near-defeat, and a reminder of the fact that their future depends on the strength of their faith in God (cf. verse 139 above) and not on a fleeting desire for self-sacrifice.” 
Tafhim al-Qur’an – Sayyid Abul Ala Maududi:
“100 God is encouraging the Muslims by mentioning the victory in the battle of Badr, saying, “When the disbelievers did not lose heart by the blow at Badr, why should you, the believers, lose heart by the blow at Uhud?”
101 The original Arabic text may imply either of the two things: “Allah desired to give some of you the honour of martyrdom. ” Or it may mean, “He willed to winnow the Believers from the hypocrites so that the true witnesses of the Truth, who may really be worthy of performing the mission that has been assigned to the Muslim Community, may be distinguished from the false ones.”
102 This alludes to those who were so desirous of martyrdom that they had persuaded the Holy Prophet against his wish to go out of Al-Madinah to fight with the enemy.” 
Malik Ghulam Farid:
“488. Elsewhere (3:166), it is said that Muslims inflicted upon disbelievers an injury double of what they themselves had suffered. This refers to the Battle of Badr, when seventy Meccans were killed and seventy were taken prisoner, thus making a total of 140. In the Battle of Uhud, on the other hand, seventy Muslims were killed, but not one of them was taken prisoner. Thus Muslims had inflicted on the disbelievers a double injury in the Battle of Badr compared with what they themselves suffered in the Battle of Uhud. Taking into account, however, only those killed in the two battles, the loss of Muslims and disbelievers has been spoken of in the present verse as similar. Or the verse might be taken to refer to the nature or quality of the misfortune, which was alike in both cases. In that case verse 166 below might be taken to refer to the quantity and the present verse to the quality of the loss.
488b. ‘Days of prosperity’ or ‘days of misfortune’.
489. God being Omniscient does not stand in need of adding to His knowledge. It is only the act of distinguishing between two things that is meant here. Knowledge (ilm) is of two kinds. One kind of knowledge consists in knowing a thing before it comes into existence; and the other in knowing when, and as, it actually comes into existence. Here it is the latter kind of knowledge that is meant.
490. The faithful bear witness to the truth of Islam by their steadfastness and by the noble example they set in time misfortune.
491. The reverse suffered by Muslims at Uhud served as a sort of atonement for their lapse. Besides, the battle made some disbelievers realize that Islam was God’s own religion. The very Meccans who took a leading part against the Muslims in that battle became converted to Islam not long after the battle. Islam had conquered their hearts, ‘destroying’ their erstwhile disbelief.
492. It is trials and afflictions which test the mettle of a man; and there can be no spiritual advance or purification without them.
493. ‘Death’ here stands for war, for the result of war is death. War, as it were, meant death for the Muslims, who were extremely weak, both in equipment and numbers compared with their powerful enemy. In the Battle of Uhud the Holy Prophet proposed to fight the enemy from inside Medina, but some of his Companions, particularly those, who had not taken part in the battle of Badr, said, ‘We had longed for his day. Let us go out to fight our enemies, lest they think we are cowards’ (Zurqani, i.22). It is to this desire of the Muslims that reference is made in the words, you used to wish for such a death.” 
Maulana Muhammad Ali:
“140a. That Allah knows all that is seen or unseen and all that is manifest or concealed is asserted in numerous places in the Holy Qur’an. The knowing here and the not knowing in v. 142 refer to the knowledge of the event. Allah knew who would prove themselves true believers, who would strive hard in His way, and who would be steadfast under trials; but who did prove themselves true believers, who did strive hard, and who were steadfast in suffering could only be said to be known when these things had happened.
143a. This refers to the desire of those who insisted that they should meet the enemy in the open field, while the Prophet’s own desire was that the Muslims should defend themselves within Madinah. Their desire for fighting the enemy or for being slain in the cause of truth is called a desire for death.” 
Tafseer Anwarul Bayan – Shaykh Ashiq Ilahi Madni:
“CONSOLATION FOR THE MUSLIMS
In the first verse, Allah consoles the Muslim by reminding them that just as they suffered a setback at Uhud and 70 of their people were martyred, at the Battle of Badr, the disbelievers (kuffar) also lost 70 of their men. Allah does not allow situations to stagnate and rotates them so that at times one shall be victorious and at other times, others will emerge victorious. In this way, the Muslims were triumphant at Badr but the following year it was the turn of the disbelievers.” 
Don’t forget to follow Discover The Truth on Facebook and Twitter. PLEASE help spread the word by sharing our articles on your favourite social networks. Thank You!
 The Message of The Quran translated and explained by Muhammad Asad, page 140
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an http://www.englishtafsir.com/Quran/3/index.html#sdfootnote101sym
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid,
page 161 – 162
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction [Year 2002 Edition] by Maulana Muhammad Ali, page 174
 Illuminating Discourses on the Noble Quran – Tafseer Anwarul Bayan – By Shaykh Ashiq Ilahi Madni (r.a), volume 1, page 448