The Israelites appear to march straight from Sinai to Canaan after Exodus, which would lead them to the Beersheba Valley where cities were fortified with strong walls, and standing armies of well-trained soldiers rode war-chariots across the plains. Chaim Herzon and Mordechai Gichon, in their book, Battles of the Bible, point out Moses’ wisdom in sending respected leaders across the river to spy out the land. But these leaders return with evidence of things they’ve seen to support their reports (fruits etc.) and a declaration that the invasion is doomed to fail. In human terms it probably was, as the army that disobeys God’s order soon finds out.
In the Bible story, God banishes the Israelites to the desert for forty years (or a generation, which might be more like twenty-five). In military terms, the Israelite army and people set off in search of a better route. The tribes to the East of Canaan have old associations with Abraham and Isaac—the Edomites, Moabites and Ammonites. Negotiating, and fighting with them is much easier. So the Israelites wander and work their way to a point on the Jordan River much further North, near Jericho.
Read Numbers 21:21-26 The Israelites are still wandering “in the desert” but they obviously know where they’re going. Israeli intelligence (remember those spies) may well have found out that Sihon had recently conquered the Moabite lowlands. He wouldn’t have had time to regroup by the time Israel arrived. So they continue to move North along the Eastern edge of Canaan.
Eventually the Israelites reach (and rest in) the sparsely settled land of Gilead, and now they try again.