These and the following verses reveal that the Israelites progressed by various stages to the Promised Land. Slavery in Egypt was a type of being part of the world. Coming out of Egypt was a type of redemption or justification. The journey through the wilderness was a type of sanctification, and entering into the Promised Land was a type of salvation.
We see several clear steps in this process. Which took the longest time? Their sanctification! They came out with a high hand: "Yeah! We're free. Everything is fine. This is going to be a lark!" But where did they do all their crying? Where did they go hungry? Where did they experience pain? Where did they quake with fear? Where did they have their greatest tests? Where did they fail? In the wilderness, in the type of sanctification.
Why did they fail? Hebrews 4:1-2 makes it clear: They failed because their faith broke down during the portion of God's plan called sanctification. We might say today, they couldn't hack it. They could not endure to the end. Thus, as these verses say, their bodies were strewn from one end of the wilderness to the other.
As mentioned, being freed from Egypt pictures redemption or justification, but there was a great deal more to come. They had to walk for a lifetime—roughly 40 years—before they approached the Promised Land. Walking out of Egypt was only the beginning.
So it is with us and the receiving of our inheritance.
One of the first things that God did after He freed Israel was to enter into a covenant with them and to reveal His laws to them. There is a parallel, a pattern, here. Many want to do away with the laws of God, but if we do that—from the clear pattern shown in the Old Covenant—then we are destroying the rules of the game. It is nullifying part of the very elements necessary for our purification, which prepares us to inherit the Kingdom of God.
The revelation of the law was necessary to prepare Israel and to set down the rules for their relationships between themselves and with God. The law was designed to prepare them to be fit to live in their inheritance. It did not save or redeem them—God did that. The law's purpose was to prepare them.