Leviticus 12:3
On the eighth day the boy is to be circumcised.
Joshua 5:7
So he raised up their sons in their place, and these were the ones Joshua circumcised. They were still uncircumcised because they had not been circumcised on the way.
Membership of God's covenant people was a voluntary thing - people could opt-in (as did Ruth, Uriah the Hittite and many others) or they could refuse to keep the covenant and disassociate themselves from the covenant people.
There are many (almost toooo many) examples of people not obeying the covenant and disobeying God and his instructions. Even Moses' wife initially refused to obey God and refused to circumcise her own sons (EX 24:24-27).
The incident at the entrance to the promised land is a special case - because of the rebellion at the entrance to the promised land (Num 13, 14), the practice of circumcision was discontinued because it was a sign of the Abrahamic covenant Gen 17:10, 11, 13, associated with the promised land Gen 17:8.
That is, because of the rebellion, God declared in Num 14:23 -
not one of them will ever see the land I promised on oath to their ancestors. No one who has treated me with contempt will ever see it.
The promised land of Israel was part of the Abrahamic covenant which was effectively ended/revoked for the people 20 years and older who rebelled at the entrance to the promised land. See Gen 17:14 which actually says this, "But if any male is not circumcised, he will be cut off from his people; he has broken My covenant." Thus, it had to be re-instituted when the Israelites were about to enter the promised land the second time in Josh 5.
That is, their lack of circumcision was a reminder that the people would not inherit the land. However, when that generation had died off, the new generation, who did inherit the land, were circumcised.
However, the requirements of the Israelite covenant (Ex 19-23) still had to be met.