Why did the Israelites wander for 40 years until they died?
Here's the answer:
The Israelites wandered around in the wilderness because of their disobedience.
When the Israelites crossed the Red Sea into the wilderness, they thought they were going straight to the Promised Land. Moses sent 12 spies to explore the land. When they returned, 10 of the spies said the people there were too strong and they could not go. The people believed these 10 spies and were afraid to go into the Promised Land like God commanded (Numbers 13 and 14).
God then told them they would not go into the Promised Land for 40 years! All of the adults alive at that time died before the Israelites entered the Promised Land—except for the two good spies, Joshua and Caleb. These two men trusted God’s promise and helped lead the next generation of Israelites into their new land where God gave them their own nation called Israel.
"Then Caleb interrupted the men speaking to Moses. He said, 'We should go up and take the land. We can certainly do it'" (Numbers 13:30).
"For 40 years you will suffer for your sins. That is one year for each of the 40 days you checked out the land..." (Numbers 14:34).