Deuteronomy 24:16 says “The fathers shall not be put to death for the children, neither shall the children be put to death for the fathers; every man shall be put to death for his own sin." Why then did the whole family of Achan have to die by stoning in Joshua 7:24-25, when only Achan took plunder from Jericho?
According to Rashi they were not killed. In his commentary to Joshua 7:24, Rashi writes that they were taken to see in order that they not copy his actions. Verse 25 says "וירגמו אותו" - they stoned him, in singular. "וישרפו אותם", they burned them, in plural, Rashi says refers to the tent and other property. "ויסלקו אותם" - they stoned them in plural, Rashi says refers to the animals he owned.
Gersonides (Ralbag) is puzzled by this. He offers two answers. The first is that the children were minors, and that they consequently came under the category of Achen's property, with regard to the punishment. We must then say that the verse in Deuteronomy takes apllies only once the child becomes an adult by Jewish Law. This would appear consistent with the fate of David's first child with Bathsheba, whom Nathan specifically tells David will die by Gd's will in Samuel II 12:14, due to David's sin.
The second answer mirrors Rashi's.