In Joshua 7:1, the text records that the Israelight Achan took spoils during the Israelightes' attack Jericho which was forbidden in 6:17-19:
"'...The city and all that is in it must be set apart for the Lord, except for Rahab the prostitute and all who are with her in her house, because she hid the spies we sent. 18 But be careful when you are setting apart the riches for the Lord. If you take any of it, you will make the Israelite camp subject to annihilation and cause a disaster. 19 All the silver and gold, as well as bronze and iron items, belong to the Lord. They must go into the Lord’s treasury.'"
But the Israelites disobeyed the command about the city’s riches. Achan son of Carmi, son of Zabdi, son of Zerah, from the tribe of Judah, stole some of the riches. The Lord was furious with the Israelites.
7:2-5 records that when the Israelite attacked Ai they were routed and retreated; losing 36 men.
In response (7:24-25), the people of Israel captured and killed the whole family after discovering that Achan had sinned:
Then Joshua and all Israel took Achan, son of Zerah, along with the silver, the robe, the bar of gold, his sons, daughters, ox, donkey, sheep, tent, and all that belonged to him and brought them up to the Valley of Disaster. Joshua said, “Why have you brought disaster on us? The Lord will bring disaster on you today!” All Israel stoned him to death. (They also stoned and burned the others.)
Why were Archan's children stoned and burned too?