2 If you find anyone within the towns that God, your God, is giving you doing what is wrong in God's eyes, breaking his covenant 3 by going off to worship other gods, bowing down to them - the sun, say, or the moon, or any rebel sky-gods - 4 look at the evidence and investigate carefully. If you find that it is true, that, in fact, an abomination has been committed in Israel, 5 then you are to take the man or woman who did this evil thing outside your city gates and stone the man or the woman. Hurl stones at the person until dead. 6 But only on the testimony of two or three witnesses may a person be put to death. No one may be put to death on the testimony of one witness. 7 The witnesses must throw the first stones in the execution, then the rest of the community joins in. You have to purge the evil from your community.
Matthew Henry's Commentary on Deuteronomy 17:2-7
Commentary on Deuteronomy 17:1-7
(Read Deuteronomy 17:1-7)
No creature which had any blemish was to be offered in sacrifice to God. We are thus called to remember the perfect, pure, and spotless sacrifice of Christ, and reminded to serve God with the best of our abilities, time, and possession, or our pretended obedience will be hateful to him. So great a punishment as death, so remarkable a death as stoning, must be inflicted on the Jewish idolater. Let all who in our day set up idols in their hearts, remember how God punished this crime in Israel.