Following the division of the kingdom, a tense security reality emerged. Rehoboam held an early strategic advantage over his northern rival, Jeroboam. While Jeroboam was forced to build a completely new capital in Shechem, Rehoboam was able to remain securely in the already established capital of Jerusalem [מלבי״ם].
Despite this initial advantage, the rebellion of the Israelite tribes and the sudden rise of a competing kingdom created a state of constant unrest, carrying the very real danger of outright war [רש״י, ביאור שטיינזלץ]. Rehoboam found himself at a severe numerical disadvantage, leading a much smaller population than Jeroboam. Driven by the fear of an impending attack, he quickly initiated a series of defensive measures [מלבי״ם, רלב״ג].
Central to this strategy was the construction of specialized cities designed to withstand enemy assaults. The primary approach among commentators is that these were heavily fortified strongholds equipped with thick walls, sturdy doors, and heavy bars, meant to serve as secure places of refuge. They were engineered so that an invading army could not easily conquer them in direct combat, but would instead be forced into a long and difficult siege [מצודת דוד, רלב״ג]. Offering a different perspective, another view suggests that these were actually smaller towns that Rehoboam strategically surrounded with water to boost their defenses. According to this approach, the fortification of these cities relied on a network of canals and deep bodies of water to keep enemy forces at a safe distance [רש״י].