Joshua 5:2 At that time the LORD said unto Joshua, Make thee sharp knives, and circumcise again the children of Israel the second time.
Circumcision was given as a covenant sign to Abraham and his male offspring and retinue prior to the conception of Isaac.
Genesis 17:7 And I will establish my covenant between me and thee and thy seed after thee in their generations for an everlasting covenant, to be a God unto thee, and to thy seed after thee. 8 And I will give unto thee, and to thy seed after thee, the land wherein thou art a stranger, all the land of Canaan, for an everlasting possession; and I will be their God. 9 And God said unto Abraham, Thou shalt keep my covenant therefore, thou, and thy seed after thee in their generations. 10 This is my covenant, which ye shall keep, between me and you and thy seed after thee; Every man child among you shall be circumcised. 11 And ye shall circumcise the flesh of your foreskin; and it shall be a token of the covenant betwixt me and you. 12 And he that is eight days old shall be circumcised among you, every man child in your generations, he that is born in the house, or bought with money of any stranger, which is not of thy seed. 13 He that is born in thy house, and he that is bought with thy money, must needs be circumcised: and my covenant shall be in your flesh for an everlasting covenant. 14 And the uncircumcised man child whose flesh of his foreskin is not circumcised, that soul shall be cut off from his people; he hath broken my covenant.
It was intended as a permanent reminder that being a people chosen of God they should live by his commandments and not please themselves.
Deuteronomy 10:16 Circumcise therefore the foreskin of your heart, and be no more stiffnecked.
Romans 2:29 But he is a Jew, which is one inwardly; and circumcision is that of the heart, in the spirit, and not in the letter; whose praise is not of men, but of God.
God will eventually redeem the nation of Israel as prophesied in Deuteronomy.
Deuteronomy 30:6 And the LORD thy God will circumcise thine heart, and the heart of thy seed, to love the LORD thy God with all thine heart, and with all thy soul, that thou mayest live.
Jacob and his 12 sons went down into Egypt and some 215 years later came up out of Egypt as a nation of some 600,000 men with their families.
Exodus 12:37 And the children of Israel journeyed from Rameses to Succoth, about six hundred thousand on foot that were men, beside children.
We are not to suppose that anyone can be circumcised twice - foreskins do not re-grow. The explanation of why Joshua had to ‘circumcise again the children of Israel the second time’ is given in the text:
Joshua 5:4 And this is the cause why Joshua did circumcise: All the people that came out of Egypt, that were males, even all the men of war, died in the wilderness by the way, after they came out of Egypt. 5 Now all the people that came out were circumcised: but all the people that were born in the wilderness by the way as they came forth out of Egypt, them they had not circumcised. 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. 7 And their children, whom he raised up in their stead, them Joshua circumcised: for they were uncircumcised, because they had not circumcised them by the way. 8 And it came to pass, when they had done circumcising all the people, that they abode in their places in the camp, till they were whole. 9 And the LORD said unto Joshua, This day have I rolled away the reproach of Egypt from off you. Wherefore the name of the place is called Gilgal unto this day.
All the men that came out of Egypt had been circumcised.
All the men over 20 years old at the time of leaving Egypt (save Joshua and Caleb and the Levites) had died during the 38 years wandering in the wilderness.
The male children born in the wilderness after leaving Egypt had not been circumcised.
We can compare the number of males over 20 at the coming out of Egypt with the number at the end of the 40 years:
Numbers 2:32 These are those which were numbered of the children of Israel by the house of their fathers: all those that were numbered of the camps throughout their hosts were six hundred thousand and three thousand and five hundred and fifty (603,550).
Numbers 26:51 These were the numbered of the children of Israel, six hundred thousand and a thousand seven hundred and thirty (601,730).
We see that at Gilgal as they entered the land, there were thousands of males under 40 years old that had not been circumcised. Joshua was told to circumcise these men.
It seems to me reasonable to conclude that ‘the second time’ is really a reference back to the first ‘mass’ circumcision which took place when the covenant with Abraham was made.
We are told in Genesis 14:14 that Abram had 318 men of fighting age in his retinue
Genesis 14:14 And when Abram heard that his brother was taken captive, he armed his trained servants, born in his own house, three hundred and eighteen, and pursued them unto Dan.
All the males were circumcised on the same day.
Genesis 17:23 And Abraham took Ishmael his son, and all that were born in his house, and all that were bought with his money, every male among the men of Abraham’s house; and circumcised the flesh of their foreskin in the selfsame day, as God had said unto him.
As they entered the land promised to Abraham as an independent nation the mass circumcision signified a renewing of the covenant; a new beginning in which the reproach of slavery in Egypt was ‘rolled away’ (Gilgal = "a wheel, rolling"), never to be repeated.
I hope this helps.