Following the Messenger is Better for the Believers
Allah said,
كَمَآ أَخْرَجَكَ رَبُّكَ
(As your Lord caused you to go out...) After Allah described the believers as fearing their Lord, resolving matters of dispute between themselves and obeying Allah and His Messenger , He then said here, "since you disputed about dividing war spoils and differed with each other about them, Allah took them away from you. He and His Messenger then divided them in truth and justice, thus ensuring continued benefit for all of you. Similarly, you disliked meeting the armed enemy in battle, who marched in support of their religion and to protect their caravan. You disliked fighting, so Allah decided that battle should occur and made you meet your enemy, without planning to do so on your part.' This incident carried guidance, light, victory and triumph. Allah said;
The verses cited above describe the event of Badr and point out to blessings which descended upon Muslims in the form of Divine help and support during the Battle.
In the first (7) and the second (8) verses, it has bees% stated that at the time the Holy Prophet ﷺ and the noble Companions ؓ got the information that a virtual army of the Quraysh has already left Makkah to give a security cover to their trade caravan, Muslims found that they now have two groups to deal with. One of the two was the trade caravan which has been called: عِیر (` ir) in relevant narrations. The other one was this very armed group which had dashed out from Makkah and which has been called: نفیر (nafir). According to the statement given in the verse, that was the time when Allah Ta` ala had made a promise to His Messenger ﷺ - and to all Muslims through him - to the effect that they will totally overcome one of the two groups so much so that they would be able to deal with it as they wished.
Now, it is obvious that overcoming a trade caravan was easy and danger-free while dealing with an armed force was fraught with all sorts of difficulties and dangers. Therefore, after hearing this seemingly ambiguous promise, it occurred to many Companions, that it would be convenient if the Divine promise, made to Muslims that they would overcome one of the two groups, were to be about the group which was simply an unarmed trading caravan. But, the Holy Prophet ﷺ and many of his leading Companions intended otherwise as Divinely guided and settled for overcoming an armed force as the better choice.
In this verse, Muslims seeking to overcome an unarmed group have been warned that they, on their part, preferred to overcome an unarmed trading caravan in view of their tilt towards personal convenience and a danger-free option. But, Allah Ta` ala intended it to be otherwise so that the real objective of Islam stands achieved, that is, truth gets to be established as the ultimate truth and the very root of disbelievers is cut off. It is obvious that this objective could be achieved only when the confrontation is against an armed force and Muslims overwhelm and overpower them.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 8–10
In Sha‘ban, (2 A.H.) the eighth month of the Islamic calendar, it came to be known that a commercial caravan of the Quraysh, carrying goods worth about fifty thousand guineas, was returning from Syria to Makkah. It was on a route which passed close by Madinah. It was feared that the Muslims might attack this caravan of their enemies. So, the chief of the caravan, Abu Sufyan ibn Harb, sent word to the people of Makkah that they should rush to him with aid, otherwise the Muslims would capture the caravan. This news created a lot of fervour in Makkah. So, a troop of 950 horsemen (600 of them fully armoured) set out from Makkah for Madinah. The Prophet was also receiving all the news. Now the Muslims of Madinah were in between two groups—one was the caravan returning from Syria, and the other was the army advancing from Makkah to Madinah. One section of the Muslims had the idea that they should advance towards the caravan. Since this caravan had only 40 guards, it could be overcome and its goods captured. But God’s plan was different. In fact, God wanted to crush the strength of those who deny the truth rather than permit the Muslims to make some material gain. God, therefore, created special conditions and caused all the chiefs of the opponents to set out from Makkah and reach Badr, a place 20 miles from Madinah, so that they should finally perish forever after clashing with the Muslims. When the Prophet informed the Muslims of God’s plan, they all agreed and proceeded towards Badr. Their strength was only 313 and they were ill-equipped. But God gave them special aid, and they routed the army of the Quraysh. Seventy of their chiefs were killed and seventy were taken prisoner. The battlefield of Badr became the scene of Islam’s victory over the deniers of the Truth. Whenever it happens that there is material benefit on the one hand and religious benefit on the other, this division itself proves that God’s will and pleasure centre upon religious benefit and not upon material benefit.The target of Islamic effort is never the attainment of economic advantages. The purpose of Islamic struggle is always to break the strength of falsehood, either by ideological superiority or, through material power as dictated by the circumstances.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.