The people of Moab and the Ammonites descended from Lot’s relationship with his daughters (Genesis 19:30–38). Although related to Israel, both nations were Israel’s enemies.
The Amalekites were nomads who attacked Israel in the desert, and Israel was commanded to remain hostile toward them (Numbers 24:20; Deuteronomy 25:17–19). These three nations likely joined forces because they feared Israel's expansion.