Look at the upper-right of this map and find "The Edomites." Now find Kadesh-Barnea, labeled to their west. The direct route from Kadesh to Canaan ran through Edomite territory along the King's Highway — one of the great trade routes of the ancient world, running from the Gulf of Aqaba through Edom, Moab, and Ammon all the way to Damascus. A straight shot. Moses sent messengers ahead: "Let us pass, I pray thee, through thy country... we will go by the king's highway" (Numbers 20:17). Edom said no. They came out with a large army to reinforce the answer.
Israel turned away. There was no battle — God had not authorized one. Edom was descended from Esau, and God had told Moses explicitly: "Ye shall not abhor an Edomite; for he is thy brother" (Deuteronomy 23:7). The rejection stung, but the response was compliance. Israel turned south from Kadesh, around the bottom of Edom's territory, down to Ezion-Geber at the Gulf of Aqaba — find it on this map — and then north along the eastern edge of Edom's mountains.
Find "The Moabites" labeled north of Edom on the map. God told Moses to treat Moab carefully as well — they were descendants of Lot, Abraham's nephew, and God had given Moab their land. Israel marched east of Moab's territory without engaging them. But then came Sihon the Amorite king of Heshbon — find Heshbon labeled on the map. Sihon controlled territory that Moab had once held north of the Arnon River. Moses sent the same polite request: let us pass through. Sihon refused and attacked. God gave Israel the victory, and they possessed Sihon's entire territory from the Arnon to the Jabbok.
Then Og, king of Bashan, came against them. God told Moses: "Fear him not: for I have delivered him into thy hand" (Numbers 21:34). Og was destroyed. His territory fell to Israel. The two Transjordanian kingdoms that no one had asked for became Israel's first territorial acquisitions — and the land that the tribes of Reuben, Gad, and half of Manasseh would eventually inherit. Edom's refusal, meant to block Israel, had rerouted them into territory that became part of the inheritance anyway.