This verse relates to the hypocrites who are getting admonished by God for not participating in the expedition of Tabuk (Tafsir Ibn Kathir and Ibn Juzayy).
For more information on the expedition of Tabuk, please read the following article: “Answering Jihad: ‘Fight Against Those Who Do Not Believe’ – Quran 9:29”
“It was not [proper] for the people of Madinah and those surrounding them of the bedouins that they remain behind after [the departure of] the Messenger of Allah or that they prefer themselves over his self. That is because they are not afflicted by thirst or fatigue or hunger in the cause of Allah, nor do they tread on any ground that enrages the disbelievers, nor do they inflict upon an enemy any infliction but that is registered for them as a righteous deed. Indeed, Allah does not allow to be lost the reward of the doers of good.” – Quran 9:120
9:120 – The verse admonishes those who didn’t participate in the expedition of Tabuk, against the Byzantine army, who declared war on Muslims and were on planning to wipe out the Muslim community, 1400 years ago. The second part of the verse describes the rewards people will get for those who went in the souring heat to defend the community.
Maulana Muhammad Ali:
“120a. The meaning is that they should neither desire rest for themselves, nor comfort, nor protection, in preference to the Prophet; in other words, they should accompany him in difficulty and distress.” 
Ibn Juzayy (1321 – 1357 AD)
“(The people of Madina…) This is criticism of those of the people of Yathrib and nearby Bedouin tribes who stayed behind from the Tabuk expedition. (and prefer themselves to him) i.e. they should not refrain from plunging into the hardships which the Prophet, may Allah bless him and grant him peace, bore. …” (Ibn Juzayy on Surah 9:120 – Online Source)
Tafsir Ibn Kathir (1301 – 1373 AD):
“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 (Byzantine army), (nor inflict), a defeat on the enemy (Byzantine army),
(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).” (Tafsir Ibn Kathir on Surah 9:120 – Online Source)
 The Holy Quran, Arabic Text with English Translation, Commentary and comprehensive Introduction [Year 2002 Edition] by Maulana Muhammad Ali, page 428