سُبْحَانَ ٱللَّٰهِ
Holy Qur'an
Al-Qur'an
Kids Qur'an
I.e., to facilitate the military operations against the strongholds of the Banu 'n-Nadir ('Abd Allah ibn Mas'ud, as quoted by Zamakhshari et al.). It should, however, be noted that apart from such stringent military exigencies, all destruction of enemy property - and, in particular, of trees and crops - had been and continued to be prohibited by the Prophet (Tabari, Baghawi, Zamakhshari, Razi, Ibn Kathir), and has thus become an integral part of Islamic Law.
The Prophet (ﷺ) had instructed the Muslim army not to cut down trees, but some soldiers had to remove some palm trees to be able to enter the fort, to the dismay of Banu An-Naḍîr. When Muslims disagreed on that act, this verse was revealed.
The arrogance of the Banu Nadhir had to be humbled, and their power for mischief destroyed.
The unnecessary cutting down of fruit trees or destruction of crops, or any wanton destruction whatever in war, is forbidden by the law and practice of Islam. But some destruction may be necessary for putting pressure on the enemy, and to that extent it is allowed. But as far as possible, consistently with that objective of military operations, such trees should not be cut down. Both these principles are in accordance with the Divine Will, and were followed by the Muslims in their expedition.