"If any man has a stubborn and rebellious son who will not obey his father or his mother, and when they chastise him, he will not even listen to them, 19 then his father and mother shall seize him, and bring him out to the elders of his city at the gateway of his home town. 20 "And they shall say to the elders of his city, ‘This son of ours is stubborn and rebellious, he will not obey us, he is a glutton and a drunkard.’ 21 "Then all the men of his city shall stone him to death; so you shall remove the evil from your midst, and all Israel shall hear of it and fear," (Deut. 21:18-21).

This seemingly harsh punishment for rebellion has been used by the critics of Christianity to infer the moral backwardness of Old Testament ethics. It is easy to throw stones from the comfort of our 21st-century perspective. But the ancient harsh example is intended to keep order in the family and also in society. Consider Exodus 20:12 which says, "Honor your father and your mother, that your days may be prolonged in the land which the Lord your God gives you." God's intention is that the family not degenerate to such an extent that authority is undermined. This has potential serious consequences in society as a whole should familial rebellion become rampant.

In the Old Testament, God appears harsh for three reasons. First, it was to demonstrate the exacting requirements of the Law--a perfect and demanding standard. Second, it ultimately demonstrates the need for grace that would eventually be manifested on the cross. Third, should rebellion take root the very heart of the gospel would be at risk since the prophecies of the Messiah coming to and through Israel could be undermined should rebellion become rampant and society fall apart causing the prophecies to fail. Therefore, we can conclude that this harsh requirement was a necessary legality to instill and designate the necessity of family order and respect and to ultimately provide another safeguard that would ensure the sacrifice of Christ.

Also, consider the following six points from by John Haley regarding the stores:1

That it is a son and not a daughter.
That he is "stubborn" and "rebellious," a "glutton" and a "drunkard."
The parents are the only allowed plaintiffs, and both must concur in the complaint to make it a legal one.
He is brought before the elders of the city and investigation is had into the merits of the case.
That no case is on record in which a person was put to death under this law.
That the mere fact of the existence of such a law would tend strongly to confirm the authority of parents and to deter youth from disobedience and unfilial2 conduct.

1. Haley, John W., Alleged Discrepancies of the Bible, Springdale, PA: Whitaker House, 1992, p. 288.
2. Unfilial means that which is not suitable for a son or a daughter.

Source

Out-of guild resource;
Details in the New Testament that Get Ignored