When the Prophet ﷺ was driven out of Mecca, Abu Bakr said, "They have driven out their Prophet. To Allah we belong, and to Him we shall return. They are surely doomed."Then the verse was revealed, "Permission to fight is given to those who are being fought, because they have been wronged, and indeed Allah is fully capable of granting them victory" [Hajj 22:39].Abu Bakr said, "Then I knew that there would be fighting."Ibn Abbas said, "This was the first verse revealed concerning fighting."
أخبرنا عبد الرحمن بن محمد بن سلام قال حدثنا إسحق الأزرق قال حدثنا سفيان عن الأعمش عن مسلم عن سعيد بن جبير
لما أخرج النبي ﷺ من مكة قال أبو بكر أخرجوا نبيهم إنا لله وإنا إليه راجعون ليهلكن فنزلت {أذن للذين يقاتلون بأنهم ظلموا وإن الله على نصرهم لقدير} فعرفت أنه سيكون قتال قال ابن عباس فهي أول آية نزلت في القتال
Sourcing, [sahih] Tirmidhi transmitted it in tafsir of the Quran, chapter "And from Surah Hajj," no. 3171, from the hadith of Ishaq bin Yusuf Azraq with this wording. It is also in Kubra, no. 4292. Ibn Hibban graded it sahih, no. 1687, as did Hakim, 22/66, 246, 390.Sufyan is Thawri, and Shubah followed him in narrating it (Mustadrak of Hakim, 3/7, 8, where he graded it sahih according to the criteria of the two Shaykhs), as did Qays bin Rabi, 2/246.