Battle of Badr (624 AD). This battle ensued as a consequence of the Quraysh continually persecuting Muslims. Read more about the hostilities of Quraysh against Muslims: ‘Did Quraysh Persecute Muslims When They Fled To Madinah?‘
8:38 Say to those who have disbelieved [that] if they cease, what has previously occurred will be forgiven for them. But if they return [to hostility] – then the precedent of the former [rebellious] peoples has already taken place.
8:39 And fight them until there is no fitnah and [until] the religion, all of it, is for Allah. And if they cease – then indeed, Allah is Seeing of what they do.
8:40 But if they turn away – then know that Allah is your protector. Excellent is the protector, and Excellent is the helper.
8:41 And know that anything you obtain of war booty – then indeed, for Allah is one fifth of it and for the Messenger and for [his] near relatives and the orphans, the needy, and the [stranded] traveller, if you have believed in Allah and in that which We sent down to Our Servant on the day of criterion – the day when the two armies met. And Allah, over all things, is competent.
8:42 [Remember] when you were on the near side of the valley, and they were on the farther side, and the caravan was lower [in position] than you. If you had made an appointment [to meet], you would have missed the appointment. But [it was] so that Allah might accomplish a matter already destined – that those who perished [through disbelief] would perish upon evidence and those who lived [in faith] would live upon evidence; and indeed, Allah is Hearing and Knowing.
8:43 [Remember, O Muhammad], when Allah showed them to you in your dream as few; and if He had shown them to you as many, you [believers] would have lost courage and would have disputed in the matter [of whether to fight], but Allah saved [you from that]. Indeed, He is Knowing of that within the breasts.
8:44 And [remember] when He showed them to you, when you met, as few in your eyes, and He made you [appear] as few in their eyes so that Allah might accomplish a matter already destined. And to Allah are [all] matters returned.
8:45 O you who have believed, when you encounter a company [from the enemy forces], stand firm and remember Allah much that you may be successful.
8:46 And obey Allah and His Messenger, and do not dispute and [thus] lose courage and [then] your strength would depart; and be patient. Indeed, Allah is with the patient.
8:47 And do not be like those who came forth from their homes insolently and to be seen by people and avert [them] from the way of Allah. And Allah is encompassing of what they do.
8:48 And [remember] when Satan made their deeds pleasing to them and said, “No one can overcome you today from among the people, and indeed, I am your protector.” But when the two armies sighted each other, he turned on his heels and said, “Indeed, I am disassociated from you. Indeed, I see what you do not see; indeed I fear Allah . And Allah is severe in penalty.”
8:38 – Here God is warning the pagan Quraysh that if they cease from their hostilities against the Muslims, they will be forgiven. But if they return to aggression and persecuting the believers then they will face the consequences.
8:39 – As we have explained previously here, the words used here is directed at the believers, that they should fight only those who oppress and persecute innocents. Until man is free to worship freely (Muhammed Asad Tafsir).
8:40 – If the Quraysh turn away from fighting i.e., cease fighting the believers, then know that God is the protector and an excellent helper (Tafsir Ibn Kathir). 
8:41 – The things that are taken in war, one fifth of it goes to the Prophet (p) and his relatives and the orphans, the poor. When one side loses, things gets left behind, for example horses, camels, swords, the victor takes. These stuff were mainly given to the orphans and the poor (Tanwir al-Miqbas min Tafsir Ibn ‘Abbas). When they fled from Madinah, many of their household stuff were stolen by the Quraish. When they lived in Madinah they didn’t have anything to feed themselves.
8:42 – This passage speaks of Quraysh’s caravan incident.
8:45 – Here, the believers were told that if the enemy forces approaches that they should stand firm facing the Quraysh. And ordered to remember God Almighty so that they become the victors (Tanwir al-Miqbas min Tafsir Ibn ‘Abbas and Tafsir al-Jalalayn).
“37 I.e., from their endeavour to turn others away from the path of God and from waging war against the believers.
38 Lit., “the example (sunnah) of the people of old times has already come to pass”: an allusion to the disasters that have overtaken, and are bound to overtake, those who persistently deny moral truths.
39 I.e., until man is free to worship God. Cf. the identical phrase in 2:193, and the corresponding note. Both these passages stress self-defence – in the widest sense of this word – as the only justification of war.
40 I.e., He knows their motives, and will requite them according to their merits.
41 According to verse 1 of this surah, “all spoils of war belong to God and the Apostle”, i.e., are to be administered by the authorities of an Islamic state in the interests of the common weal. Most of the great Islamic jurists are of the opinion that whereas four-fifths of all spoils may either be distributed among those who actively took part in the war effort or may be otherwise utilized for the welfare of the community, one-fifth must be reserved for the specific purposes enumerated in the above verse, including a share “for God and the Apostle” (which is obviously a metonym for a government that rules in accordance with the laws of the Qur’an and the teachings of God’s Apostle); this latter share is to be used for the exigencies of state administration. Since a full discussion of this complex juridical problem would go far beyond the scope of these explanatory notes, the reader is referred, in particular, to Manar X, 4 ff., where the views of the classical exponents of Islamic jurisprudence are summarized. – For the term ibn as-sabil occurring in this verse, see surah 2, note 145. By “the near of kin and the orphans” apparently the relatives of fallen combatants are meant in this context.
42 I.e., “He can grant you victory or can withhold it from you”. The battle of Badr is described here as “the day when the true was distinguished from the false” (yawm al-furqan) because on that occasion a small and poorly armed group of believers utterly destroyed an infinitely better equipped army more than three times its number. The revelation referred to in this connection was God’s promise of victory, given in verses 12-14 of this surah. (See also note 38 on 2:53.)” 
Malik Ghulam Farid:
“1120. Muslims were enjoined to fight till religious persecution has ceased and men were free to practice the religion of their choice. Islam undoubtedly is the greatest upholder of freedom of conscience (2:194).
1121. The words mean, ‘if they refuse to accept the offer of peace made to them and start hostilities again.’” 
Maulana Muhammad Ali:
“38a. Desisting and returning both relate to fighting against the Muslims, not to unbelief, because the unbelievers could not be said to return to disbelief. They had gone away from Badr quite discomfited, and they were told that, if they desisted from fighting, they would be forgiven.
38b. The meaning is that they could read their own doom in the doom of those with whom Allah had dealt previously in similar circumstances. Compare 18:55, which states that the disbelievers only wait “for the way of the ancients to overtake them.”
39a. That is, if they desist from fighting and put an end to their mischief, God’s decree of punishment will not be executed. God sees what men do, and if they mend their ways, He will not punish them. The state of religious liberty which Islam aimed at is put tersely in the two opening statements — there is no more persecution and all religions are for Allah.
40a. If they return to fight, then Allah will protect the Muslim community, helping them against their enemy, as He is their Patron and Helper.
41a. LL explains ghanama as meaning he acquired a thing without difficulty. Hence the original meaning of the word ghanimah is simply acquisition or achievement, and the word is then applied to what is acquired in war after fighting with the enemy and vanquishing him, and is a technical term for such property. Regarding the one-fifth spoken of here, the most generally accepted opinion is that it is to be divided again into five parts, the Prophet, the near of kin, the orphans, the poor, and the wayfarer being equal sharers. The near of kin included all individuals belonging to the tribes of Bani Hashim and Bani ‘Abd al-Muttalib, to whom zakat money was not allowed. The poor among them were thus paid from this source of income. As to the Prophet’s twenty-fifth, it appears that it was also used for the benefit of the Muslims. The words of one of his sayings are: wa-l-khumsu mardud-un fi-kum, i.e. the fifth (too) is given back to you. That the Prophet led a life of the utmost simplicity is admitted on all hands. The remaining four-fifths of the ghanimah were divided among those who took part in the battle, as they were not otherwise paid for their services, but there is no order to this effect in the Qur’an itself. It may be further noted that this arrangement was simply an exigency. The war was forced on the Muslims all of a sudden when the State had not yet been formed in the proper sense of the word; there was no army at all, nor a treasury from which to pay it; and just as they were required to carry it on on the basis of voluntary gifts, so they were allowed a share in the war acquisitions. If the State pays its soldiers as it pays its civil servants, the war acquisitions would all go to the State treasury, just as income from zakat or tribute went to the State treasury. It is nowhere laid down that the Muslim State shall not maintain a regular army. The day of Discrimination referred to here is the battle of Badr. It is so called because prophecies of an encounter between the Muslims and their enemies and of the vanquishment of the enemy are met with in very early revelations. See also 3:13a. 42a. The position of the three parties, i.e. the party of the Muslims and two parties of the Quraish, is here made clear. The Muslims were on the nearer side, i.e. the side nearer to Madinah, the main army of the Quraish was on the further side, i.e. the side which was farther from Madinah, while the caravan was in a lower place, i.e. towards the sea-coast, and farther away from Madinah, on its way to Makkah.
42b. The Muslims were so weak that they could not think of making an appointment with the enemy — they would have broken away from the appointment.
42c. There is an ellipsis here, the meaning being, but an encounter was brought about without an appointment.” 
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!
 Tafsir Ibn Kathir: http://www.qtafsir.com/index.php?option=com_content&task=view&id=1543&Itemid=63
 The Message of The Quran translated and explained by Muhammad Asad, page 353
Click to access The_Message_of_The_Quran__by_Muhammad_Asad.pdf
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid,
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction [Year 2002 Edition] by Maulana Muhammad Ali, page 385 – 387