Question: A man fights so that the Word of Allah may be supreme, and also for war booty. What is the ruling on this intention?
Answer: That does not harm (his intention), as is evidenced by His saying, Exalted is He: “˹Remember, O believers,˺ when Allah promised ˹to give˺ you the upper hand over either target, you wished to capture the unarmed party. But it was Allah’s Will to establish the truth by His Words and uproot the disbelievers.” [Al-Anfal:7] So the Muslims went out with the Messenger of Allah, May Allah bless him and his family and grant them peace, for this, and nothing was in their reckoning except intercepting the caravan of Quraysh and obtaining the booty. They were averse to confronting the fighting force of Quraysh, as Allah related that about them. Yet Allah and His Messenger, May Allah bless him and his family and grant them peace, did not censure them for this intention. And He, Glorified is He, said: “˹He will also give you˺ another favour that you long for: help from Allah and an imminent victory.” [As-Saff:13] And He, Glorified is He, said: “Allah has promised you ˹believers˺ abundant spoils, which you will gain, so He hastened this ˹truce˺ for you and has held people’s hands back from ˹harming˺ you.” [Al-Fath: 20] And He, Exalted is He, said: “˹So˺ fight them and Allah will punish them at your hands, put them to shame, help you overcome them, and soothe the hearts of the believers—” [At-Tawbah:14] And He, Exalted is He, said: "Nor do they attain any objective against an enemy, but it is written for them as a righteous deed". [At-Tawbah:120]
All that we have mentioned indicates that seeking booty does not cause harm (to one’s intention). Rather, it indicates that it is part of exalting the Word of Allah, since the seizing as booty of the wealth of the polytheists, taking their women captive, and enslaving their offspring are things that enrage the polytheists; and enraging them is a righteous deed that serves to raise high the Word of Allah.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.2