Deuteronomy 21:21 And all the men of his city shall stone him with stones, that he die: so shalt thou put evil away from among you; and all Israel shall hear, and fear.
This passage is about a child that is rebellious, a drunkard, a glutton, and who refuses to listen or be trained. The verse has been made fun of a lot in the media. The point was that parents were supposed to raise up children that would do right.
If the child refused and couldn’t be dealt with then there was the death penalty. Obviously we are not living in the kingdom of Israel. Those rules are not our rules. We never practice this.
I have seen no evidence that this was ever carried out but it is still a truth that needed to be communicated. If there is sin it should be dealt with. If a person refuses to get their life right then there will be consequences.
When sin and rebellion have no consequences then others are brave enough to do the same things. If we treat sin correctly then others will think twice about doing the same thing.