In their hasty retreat from the battlefield, the Philistines abandoned the ritual objects they had brought with them into combat [ביאור שטיינזלץ]. These left-behind items were not merely simple amulets. They were actual deities that the Philistines actively worshipped [מלבי״ם].
Upon discovering these idols, David ordered their immediate destruction by fire, acting in accordance with the Torah's instruction to completely eradicate idolatry [ביאור שטיינזלץ]. This act of burning resolves a potential misunderstanding from a parallel account of the event. While another record suggests that David carried the objects away, leading one to mistakenly assume he took the idols to Jerusalem as spoils of war, the reality was quite different. The description of the idols being lifted and carried away actually refers to the smoke rising into the air as they burned, showing that they were entirely consumed by the flames and completely destroyed [מלבי״ם].