Joshua 5:6
For the children of Israel walked forty years in the wilderness, till all the people that were men of war, which came out of Egypt, were consumed, because they obeyed not the voice of the LORD: unto whom the LORD sware that he would not shew them the land, which the LORD sware unto their fathers that he would give us, a land that floweth with milk and honey.
The verse marks the close of Israel's forty years of wilderness wandering as the people reached the promised land after the long desert sojourn that followed the sin at Kadesh. Gilgal was their first encampment there in the land. All the men of war who came out of Egypt were consumed in the wilderness because they disobeyed the voice of the Lord, failing to trust Him in unbelief and rebellion.
That disobedience kept Israel wandering forty years and delayed entry into Canaan, which they had expected to inherit soon after leaving Egypt. They could have possessed Jericho forty years earlier if they had trusted God. Those whom Joshua circumcised at Gilgal were the generation born in the wilderness during those forty years, circumcised according to God's instruction as the recognition of God's covenant.
This took place in order after the miraculous passage over the swollen Jordan on dry land and before the observance of the Passover. Israel kept the Passover in the plains of Jericho, their first Passover since the wanderings, and afterward the manna ceased. The long failure to possess Canaan had given the Amorites, Canaanites and other heathen nations occasion to reproach the Lord and His people, triumphing that God was not able to lead them into Canaan. God's leading Israel over Jordan on dry land manifested His power and favor and rolled away that reproach of Egypt.
The history belongs to the time just before the taking of Jericho, when God Himself worked for Israel through the divine Commander of the Lord's army to throw down its walls, followed by the appearance of that Angel of the covenant and the overthrow of the city. That divine victory at Jericho gave solemn weight to God's command prohibiting Israel from taking the spoils. The same divine working guarantees victory to the third angel's message and the triumph of the Lord's commandment-keeping people, with every opposing element defeated. Israel's experiences during the forty years, through both failure and victory, taught lessons, and the principles God had given them were to guide each new step.