مَا كَانَ لِأَهۡلِ ٱلۡمَدِينَةِ وَمَنۡ حَوۡلَهُم مِّنَ ٱلۡأَعۡرَابِ أَن يَتَخَلَّفُواْ عَن رَّسُولِ ٱللَّهِ وَلَا يَرۡغَبُواْ بِأَنفُسِهِمۡ عَن نَّفۡسِهِۦۚ ذَٰلِكَ بِأَنَّهُمۡ لَا يُصِيبُهُمۡ ظَمَأٞ وَلَا نَصَبٞ وَلَا مَخۡمَصَةٞ فِي سَبِيلِ ٱللَّهِ وَلَا يَطَـُٔونَ مَوۡطِئٗا يَغِيظُ ٱلۡكُفَّارَ وَلَا يَنَالُونَ مِنۡ عَدُوّٖ نَّيۡلًا إِلَّا كُتِبَ لَهُم بِهِۦ عَمَلٞ صَٰلِحٌۚ إِنَّ ٱللَّهَ لَا يُضِيعُ أَجۡرَ ٱلۡمُحۡسِنِينَ
It did not befit the people of Medinah and the people of the villages around them, to stay behind the Noble Messenger of Allah, nor to consider their own lives dearer than his life; that is because the thirst or the pain or the hunger that afflicts them in Allah's cause, and the step they tread on a place that angers the disbelievers, and whatever harm they cause the enemy – a good deed is recorded for them in lieu of all of these; indeed Allah does not waste the wages of the virtuous.
Tafsir:
Rewards of Jihad
Allah, the Exalted and Most Honored, criticizes the people of Al-Madinah and the bedouins around it, who did not participate in the battle of Tabuk with the Messenger of Allah ﷺ. They sought to preserve themselves rather than comfort the Messenger ﷺ during the hardship that he suffered in that battle. They incurred a loss in their share of the reward, since,
لاَ يُصِيبُهُمْ ظَمَأٌ
(they suffer neither Zama'), thirst,
وَلاَ نَصَبٌ
(nor Nasab), fatigue,
وَلاَ مَخْمَصَةٌ
(nor Makhmasah), hunger,
وَلاَ يَطَأُونَ مَوْطِئًا يَغِيظُ الْكُفَّارَ
(nor they take any step to raise the anger of disbelievers), by strategies of war that would terrify their enemy,
وَلاَ يَنَالُونَ
(nor inflict), a defeat on the enemy,
إِلاَّ كُتِبَ لَهُمْ
(but is written to their credit) as compensation for these steps that are not under their control, but a consequence of performing good deeds that earn them tremendous rewards,
إِنَّ اللَّهَ لاَ يُضِيعُ أَجْرَ الْمُحْسِنِينَ
(Surely, Allah wastes not the reward of the doers of good.) Allah said in a similar Ayah,
إِنَّا لاَ نُضِيعُ أَجْرَ مَنْ أَحْسَنَ عَمَلاً
(Certainly We shall not make the reward of anyone who does his (righteous) deeds in the most perfect manner to be lost)