The Quraysh came from Makkah to Madinah to fight the Muslims. This happened as a result of Quraysh losing at the battle of Badr, and hence they wanted revenge. These particular verses were revealed concerning the battle of Uhud (Tafsir al-Jalalayn, Tanwir al-Miqbas min Tafsir Ibn ‘Abbas, Asbab Al-Nuzul by Al-Wahidi, Tafsir al-Tustari and Ibn Kathir). For further details on this battle, please click on the following article: ‘The Battle Of Uhud – Quraysh Declared War‘.
3:152 And Allah had certainly fulfilled His promise to you when you were killing the enemy by His permission until [the time] when you lost courage and fell to disputing about the order [given by the Prophet] and disobeyed after He had shown you that which you love. Among you are some who desire this world, and among you are some who desire the Hereafter. Then he turned you back from them [defeated] that He might test you. And He has already forgiven you, and Allah is the possessor of bounty for the believers.
3:153 [Remember] when you [fled and] climbed [the mountain] without looking aside at anyone while the Messenger was calling you from behind. So Allah repaid you with distress upon distress so you would not grieve for that which had escaped you [of victory and spoils of war] or [for] that which had befallen you [of injury and death]. And Allah is [fully] Acquainted with what you do.
3:154 Then after distress, He sent down upon you security [in the form of] drowsiness, overcoming a faction of you, while another faction worried about themselves, thinking of Allah other than the truth – the thought of ignorance, saying, “Is there anything for us [to have done] in this matter?” Say, “Indeed, the matter belongs completely to Allah.” They conceal within themselves what they will not reveal to you.
They say, “If there was anything we could have done in the matter, some of us would not have been killed right here.” Say, “Even if you had been inside your houses, those decreed to be killed would have come out to their death beds.” [It was] so that Allah might test what is in your breasts and purify what is in your hearts. And Allah is Knowing of that within the breasts.
3:155 Indeed, those of you who turned back on the day the two armies met, it was Satan who caused them to slip because of some [blame] they had earned. But Allah has already forgiven them. Indeed, Allah is Forgiving and Forbearing.
3:156 O you who have believed, do not be like those who disbelieved and said about their brothers when they traveled through the land or went out to fight, “If they had been with us, they would not have died or have been killed,” so Allah makes that [misconception] a regret within their hearts. And it is Allah who gives life and causes death, and Allah is Seeing of what you do.
3:157 And if you are killed in the cause of Allah or die – then forgiveness from Allah and mercy are better than whatever they accumulate [in this world].
3:158 And whether you die or are killed, unto Allah you will be gathered.
3:152 – speaks about the battle of Uhud where they were promised that they would have the upper hand against the tyrants who came from Makkah to Madinah to wage war, until the Muslims ‘lost courage’ due to some of them arguing or not listening to the command the Prophet (p) gave to them, and hence some of those who disobeyed the Prophet’s order, were killed by the enemy.
The verse further highlights that some of those who were on the Muslim side, were in love with this life, and there were others who were yearning for the hereafter. Because of the dispute and not listening to the Prophet (p) command(s) they lost this battle.
3:153 – This verse reiterates some of the points highlighted in the previous verse, that some of the Muslims disobeyed the Prophet’s command and hence were attacked by the enemies.
3:155 – This verse mentions what has already been spoken about that some of the Muslims disobeyed the Prophet’s command. Here God Almighty blames Satan for seducing them to slip-up. But God forgave them for what they did.
3:157 – Here God promises those who fought for justice, i.e., defending the lives of the oppressed, by fighting in the cause of God against the Quraysh, if they died (became martyr’s) they would be forgiven and would be rewarded with Paradise.
3:158 – God says that those who died will return to HIM.
“107 Lit., “when you were destroying them”: a reference to the opening stages of the battle of Uhud. Regarding the promise alluded to, see verses 124-125 of this surah.
108 Lit., “you disagreed with one another regarding the [Prophet’s] command” – an allusion to the abandonment of their post by most of the archers at the moment when it seemed that victory had been won (see note 90 above).
109 Out of the fifty Muslim archers less than ten remained at their post.
And were killed by Khalid’s cavalry. It is to them, as well as the few Companions who went on fighting after the bulk of the Muslims had fled, that the second part of the above sentence refers.
110 Lit., “He turned you away from them”.
111 I.e., the realization of how shamefully they had behaved at Uhud (see note 90 above) would be, in the end, more painful to them than the loss of victory and the death of so many of their comrades: and this is the meaning of the “test” mentioned in the preceding verse.” 
Tafhim al-Qur’an – Sayyid Abul Ala Maududi:
“108a This refers to the conduct of the archers. When they were commanded to abstain from taking spoils, they argued with and disobeyed their leader and deserted their positions with the result that the scales of victory were turned against the Muslims.
109 That is, “Your desertion was an act which would have resulted in your total destruction, if Allah had not pardoned you. It was God’s grace and succour that saved you from its grave consequences, and the Quraish, in spite of their victory, retreated of their own accord without any apparent reason.”
110 It was the courage and firmness of the Holy Prophet that saved the situation from utter ruin in the confusion caused by the sudden attack of the enemy who was charging from the front and from the rear. When some of the Muslims were fleeing towards Al-Madinah and the others were climbing up the Uhud,
The Holy Prophet stood firm and resolute at his post with a dozen or so of his Companions who had stood the test. He was rallying those who were taking to flight, calling out, “O servants of Allah, come to me.”
111 Sorrow was caused by the reverse and by the rumour that the Holy Prophet had been martyred and by the loss of their companions and by the misery of their wounded and by the insecurity of their homes and by the fear that the victorious Quraish army, that out-numbered the total population of Al-Madinah, would crush the routed army, enter into .the town and reduce it to ruins.
112 This was a favour shown to those Muslims who had remained firm in the battle. They experienced such a strange sense of security that in spite of their sorrow, they began to feel drowsy. Hadrat Abu Talhah, who had taken part in the battle, says that they were so overpowered by drowsiness that even their swords began to fall from their hands.
113 These were their vain regrets which were the result of their wrong thinking.
The fact is that the decrees of God are inevitable. Such regrets produce only grief and anguish in the hearts of those who do not trust in Allah but in their own plans and designs. However, when their efforts also end in utter failure, they wring their hands, saying, “Oh! had it been thus and thus, the result would have been so and so.” 
Malik Ghulam Farid:
“499. The ‘promise’ refers to the general promise of victory and success repeatedly given to Muslims, particularly in 3:124-126.
500. The verse refers to the party of archers posted in the rear of the Muslim army at Uhud, and points out that they could not resist the temptation of taking part in actual fighting and in sharing the booty, and their failure to control that desire was an act of cowardice on their part.
It is indeed the heart which is the seat of true bravery and courage.
501. The ‘order’ may refer either to the order of the Holy Prophet given to the party of archers on the hill not to leave their station without his permission, or to its import and significance, i.e., whether the Holy Prophet had really meant them to stay there even after the battle had been won; some saying that he did mean it and others alleging that he did not.
502. Muslims stationed at the hill paid no heed to their leader Abd Allah b. Jubair, who, in compliance with the order of the Holy Prophet, told them not to quit the place, even if victory was within sight. They could not control themselves, and the result was that their act caused great suffering to Muslims.
503. The words refer to those archers who quitted the place at which they had been stationed. The Arabic clause may also signify that some members of the party desired the present world, i.e., taking part in the fighting and collecting booty, while others (viz., Abd Allah b. Jubair and those of his comrades who did not quit their posts) desired the Hereafter, i.e., they thought of the ultimate consequence of disobeying the command of the Holy Prophet. Some were short-sighted, while others were far-sighted.” 
Maulana Muhammad Ali:
“152a. The promise is contained in v. 124: “When thou didst say to the believers: Does it not suffice you that your Lord should help you with three thousand angels?”
152b. It clearly shows that the Muslims had obtained a victory at Uhud, later incidents depriving them of the fruits of that victory. Though apparently all the fighters are spoken of here as becoming weak-hearted, the reference is only to that group of archers who disobeyed the Prophet’s orders, as the words that follow show:
Of you were some who desired this world. Nor did any of the Muslims show any weak-heartedness in fighting against the enemy.
The weak-heartedness of a part of the archers who were placed in an important position to cut off the enemy’s retreat consisted in their disobeying the clear orders of the Prophet: “If you see us overcoming the enemy leave not your position, and if you see the enemy overcoming us, leave not your position”, the Prophet had told the archers.
But they fell a prey to the love of the world and left their position to get a share in the booty when they saw the enemy fleeing before the Muslim onrush.
152c. These were the two parties of the body of archers. When the enemy was apparently routed, some of these archers were led by the love of plunder to leave their position, while their chief, ‘Abd Allah ibn Jubair, with only some ten men, stuck to their post. Muslims were required to fight in Allah’s way, and if any Muslim fought for plunder, he fought for the love of this world and not in Allah’s way.
152d. The enemy, who was being pursued, turned against the pursuers on seeing the important position of the archers vacated, and the result was that the Muslims who were now in disorder on account of the pursuit found themselves helpless against the enemy who turned back on them.
And some of them who were cut off from the main body took to flight. We are, however, here told that God pardoned them as their flight was the result of circumstances which were beyond their control. ‘Uthman is said to have been one of them.
153a. It refers to the Prophet’s call, at whom the Muslims now saw that the attack of the enemy was directed. So they did not grieve for losing an opportunity of pursuing the enemy, but for the dangerous position in which they saw the Prophet.
This is, in fact, plainly stated in what follows: “that you might not grieve at what escaped you,” i.e. the booty which they would have had by pursuing the fleeing enemy, “nor at what befell you,” i.e., the loss which they themselves suffered. Athaba sometimes conveys the idea of giving one thing instead of another, the giving of a substitute (LL). They forgot their own grief when they saw that it was the Prophet at whom the attack was directed now.
154a. Nu‘as means slight sleep; it is said that nu‘as here implies calm and quiet (R). It must have happened when the enemy departed. The slumber was a sign of security, for no army could have gone to rest while yet in the field of battle if it had the least anxiety as to its security.
154b. The persons spoken of here are the disaffected who took no part in fighting. They now gave vent to their hidden rancour against the Muslims. The evil thoughts which the hypocrites entertained about Allah were that Allah had not helped the Muslims.
154c. The hypocrites sided with the minority whose counsel was that the Muslims should not fight the enemy in the open field and should remain besieged in Madinah. The majority was, however, in favour of going out and meeting the enemy where it had encamped. The Prophet decided that the majority vote must be accepted. Hence the hypocrites’ murmuring as to why their counsel was not accepted.
154d. Their contention was that the disaster would not have befallen the Muslims if their advice as to remaining within the town had been accepted. They took no part in fighting but they spoke of the loss of the Muslims as their own loss. 154e. Remaining in the houses here signifies meeting the enemy while remaining in Madinah. By those for whom slaughter was ordained are meant the martyrs of Uhud.
The murmurings of the hypocrites are met with the reply that even if the Muslims had defended themselves by remaining in Madinah, those who laid down their lives in the field of Uhud would have laid them down in Madinah as well. Death was moreover a thing ordained.
154f. This explains Allah’s testing what is in the hearts. He knows it, and His testing it means making it manifest to others. The attitude of the hypocrites was made manifest by the fighting in Uhud. It would have remained hidden if the battle had been fought in Madinah.
155a. The persons spoken of here are those who were unable to join the main Muslim army and fled to Madinah, or in some other direction. However pressed they may have been, it was not right on their part to leave the field of battle. Here it is spoken of as a slip on their part; it did not amount to intentional disobedience and God granted them a free pardon.
156a. By “their brethren” are meant their relatives who were sincere in their profession of Islam, and who had to lay down their lives in defence of their faith.”
 The Message of The Quran translated and explained by Muhammad Asad, page 142 – 143
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an http://www.englishtafsir.com/Quran/3/index.html#sdfootnote110sym
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid, page 164
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction [Year 2002 Edition] by Maulana Muhammad Ali, page 177 – 179