This is one of the favors of Allah to people: to show them the signs, references, and examples to believe and consider, however, most of them are not grateful to Allah by thanking the Giver for these gifts.
This is a preface to encourage the Muslims to fight which is mentioned in the next Ayah. Whether in peace or war, a person has one lifetime to live.
﴿وَقَاتِلُوا فِي سَبِيلِ اللهِ وَاعْلَمُوا أَنَّ اللهَ سَمِيعٌ عَلِيمٌْ﴾ [البقرة:244]
244 - Fight in the way of Allah, sacrificing your lives and monies to make the word of Allah superior and do not fear death because this will not elongate or shorten your lifetime. Escape does not save you from death as well because death is inevitable, the sustenance is divided among the people, and no one can escape destiny. Indeed, Allah hears what you speech in all that you do, either going for Jihad or escaping it, All-Knowing of what you intended in yourselves, so hasten to obey His Orders and beware not to disobey Him.
﴿مَنْ ذَا الَّذِي يُقْرِضُ اللهَ قَرْضًا حَسَنًا فَيُضَاعِفَهُ لَهُ أَضْعَافًا كَثِيرَةً وَاللهُ يَقْبِضُ وَيَبْسُطُ وَإِلَيْهِ تُرْجَعُونَ﴾ [البقرة:245]
245 - Those who give of their money for Jihad or for any good work out of devotion and good self, Allah will accept that from Him and double the reward for Him in a way that does not expect.
Allah gives more sustenance to some people than others for wisdom and benefit that He destines. So, spend and do not be miser because Allah is the Provider of sustenance and in Whose Hands is all good.
You shall be back to Him on the Day of the Recompense to reward or retribute you for the actions you did; if they are good, you shall be rewarded and if not, you shall be punished.
﴿أَلَمْ تَرَ إِلَى المَلَإِ مِنْ بَنِي إِسْرَائِيلَ مِنْ بَعْدِ مُوسَى إِذْ قَالُوا لِنَبِيٍّ لَهُمُ ابْعَثْ لَنَا مَلِكًا نُقَاتِلْ فِي سَبِيلِ اللهِ قَالَ هَلْ عَسَيْتُمْ إِنْ كُتِبَ عَلَيْكُمُ القِتَالُ أَلَّا تُقَاتِلُوا قَالُوا وَمَا لَنَا أَلَّا نُقَاتِلَ فِي سَبِيلِ اللهِ وَقَدْ أُخْرِجْنَا مِنْ دِيَارِنَا وَأَبْنَائِنَا فَلَمَّا كُتِبَ عَلَيْهِمُ القِتَالُ تَوَلَّوْا إِلَّا قَلِيلًا مِنْهُمْ وَاللهُ عَلِيمٌ بِالظَّالِمِينَ﴾ [البقرة:246]
246 - Look at a group of people from the Children of Israel who came after Moses [peace be upon him] when their lofty people said to their prophet: Appoint a king for us to abide by his opinion in war and to fight in the case of Allah against his enemies.
Their prophet said to them: What if I answered your request and then asked you to fight but you did not abide by what you have promised?
They said: How can we do not fight while our homes have been taken away, our children have been captured, and we have been away from our wives; this is a good reason to obey you and fight.
However, when a king was appointed to lead them in war; it was the time for fighting; and were asked to set out for fight, they did not keep their promises but few of them.
Allah is All-Knowing about their forsaking Jihad and breaking the promises and shall punish them for that severely.