At that time Yahweh said to Joshua, Make you flint knives, and circumcise again the children of Israel the second time.
Another explanation is that most of the older generation simply neglected to circumcise their sons out of forgetfulness, discouragement, or for some other reason.