Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:8:5

˹It is˺ just as when your Lord brought you out of your home ˹for the battle of Badr˺ in truth, while indeed, a party among the believers were unwilling,  

As your Lord brought you forth from your home with the truth (bi’l-haqq is semantically connected to akhraja, ‘He brought forth’), and indeed a party of the believers were averse, to going forth (the ˹last˺ sentence is a circumstantial qualifier referring to the ˹suffixed pronoun˺ kāf in akhrajaka, ‘He brought you forth’; kamā, ‘as’, is the predicate of an omitted subject, in other words: their aversion to this state ˹of affairs of the booty being God’s and the Prophet’s˺ is similar to their aversion when you were brought forth ˹to fight˺, which had actually been better for them: likewise is this ˹state of affairs better for them˺). It happened that Abū Sufyān was returning from Syria with a caravan. The Prophet (s) and his followers went forth to plunder it; but Quraysh became aware of this, and so Abū Jahl and some Meccan fighters rode out to defend it — these constituted the ‘band’. Abū Sufyān drove the caravan via the coastal route and it managed to escape. Abū Jahl was then advised to return, but he refused and marched on towards Badr. The Prophet (s) consulted with his followers, saying to them, ‘God has promised me one of the two parties’. So they agreed with him to attack the ˹Meccan˺ band, but some of them were averse to this, complaining, ‘We have not come prepared for this!’, as God, exalted be He, says:
القرآن:٨:٥

كَمَا أَخْرَجَكَ رَبُّكَ مِنْ بَيْتِكَ بِالْحَقِّ وَإِنَّ فَرِيقًا مِنَ الْمُؤْمِنِينَ لَكَارِهُونَ  

{كما أخرجك ربُّك من بيتك بالحق} متعلق بأخرج {وإن فريقا من المؤمنين لكارهون} الخروج والجملة حال من كاف أخرجك وكما خبر مبتدأ محذوف أي هذه الحال في كراهتهم لها مثل إخراجك في حال كراهتهم وقد كان خيرا لهم فكذلك أيضا وذلك أن أبا سفيان قدم بعير من الشام فخرج النبي ﷺ وأصحابه ليغنموها فعلمت قريش فخرج أبو جهل ومقاتلوا مكة ليذبُّوا عنها وهم النفير وأخذ أبو سفيان بالعير طريق الساحل فنجت فقيل لأبي جهل ارجع فأبى وسار إلى بدر. فشاور النبيُّ ﷺ أصحابه وقال إن الله وعدني إحدى الطائفتين فوافقوه على قتال النفير وكره بعضهم ذلك وقالوا لم نستعدَّ له كما قال تعالى.