The Law in Joshua 7 serves not to keep people together, but to exclude. There’s a juxtaposition between the Achan story and the story of Rahab, who is part of the story of Jericho. Rahab, because she was not an Israelite should have been subject to the “ban”. She should have been murdered along with her family and the rest of the Jerichoites, but Rahab and her family were allowed to live. Joshua, apparently setting aside the legislation of Deuteronomy 20:16-18, allows Rahab, the prostitute, and her family to live. Rahab had submitted to and pledged allegiance to Joshua’s war machine. Rahab was the ultimate “outsider”, but because she surrendered to Joshua’s will she became an “insider”. Achan, was an “insider”, he had the correct lineage, but because he did not completely submit to the will of Joshua, he made himself an “outsider”.
The stories of Rahab and Achan were used to create boundaries and norms. Those who voluntarily submitted to the Law would become or remain “insiders”. Those who transgressed the Law would become “outsiders”. The punishment for being an outsider was death. The story of Achan was directed at the “insiders”, warning them that if they transgressed the Law or didn’t follow the dictates of whoever was the central authority at that time they could be subject to the death penalty. This text is intended to coerce people into submission by using the threat of homicidal violence.
I think this text is about more than just the Law and the penalties for breaking the law, or in Rahab’s case the advantages of following the Law . Breaking the Law, if those transgressions are allowed to run their full course will inevitably result in death, the actual, real world deaths of the transgressor and most likely the real world deaths of others. Most likely the death of others first, and then the death of the transgressors. The second half of the ten commandments is entirely concerned with forestalling violence. It shows that even small transgressions, if not somehow prevented from running their full course will implacably end in homicide. You shall not covet, meaning you shall not be envious of your neighbor, of either your neighbor’s possessions or your neighbors “being”. You shall not bear false witness, I think could mean you shall not project your negative beliefs and will to violence onto your neighbor. You shall not steal, I guess this means your neighbor’s possessions or your neighbor’s “being”. You shall not commit adultery, becoming directly entangled in rivalrous relations with your neighbor. Finally, the result of all these smaller sins is murder. “Thou shalt not kill”. An immediate modern example of this downward spiral is in marital relations that end in murder, I think if you look closely at some of these spousal murder cases, they follow this trajectory. So following the Law is very important, because in the end it will prevent the killing of your neighbor or neighbors.