The sudden lifting of the siege over Samaria did not occur through a physical battle, but rather through a psychological and auditory miracle. A sudden, powerful illusion of a massive approaching army struck the Aramean camp with panic, driving the soldiers to flee for their lives and abandon their positions without a fight. The primary approach among commentators is that these terrifying noises did not come from an actual military force. Through God's direct intervention, the Arameans merely imagined they were hearing the sounds of war, which explains why the camp was found completely empty afterward [רש״י, מצודת דוד].
This event took place at night, shortly before the Israelite lepers reached the camp. Had the Arameans fled during daylight, the Israelites inside the city walls would have clearly seen their retreat [רד״ק]. The miracle itself was twofold. Beyond the illusion of sound, God planted a deep anxiety in the hearts of the Aramean soldiers. He caused them to believe that the king of Israel had hired the exact armies they feared the most, forces they felt entirely powerless to resist [מלבי״ם].
In their panic, the Arameans concluded they were facing an inescapable, coordinated attack from two fronts. They interpreted the thundering sounds as an assault from the north by the kings of the Hittites—representing the small kingdoms that remained after the collapse of the Hittite empire—and from the south by the kings of Upper and Lower Egypt [ביאור שטיינזלץ]. Hearing the noise, they immediately assumed these hired forces were descending upon them [מצודת דוד].
There is a deeper spiritual reason why the illusion specifically featured the sounds of horses and chariots, evoking the fear of Egypt. When the Israelites follow God's will, He performs miracles for them directly. However, when they stray from His path, God operates through the messengers and spiritual forces of other nations. Because the Israelites of that generation were not fulfilling God's will, He used the spiritual force of Egypt, which is closely associated with horses. Consequently, God produced the specific sounds of horses and chariots, leading the Arameans to believe that the kings of Egypt were marching against them [אהבת יהונתן].