2 If there is any man or woman among you, in any of the towns which the Lord your God gives you, who does evil in the eyes of the Lord your God, sinning against his agreement, 3 By becoming a servant of other gods and worshipping them or the sun or the moon or all the stars of heaven, against my orders; 4 If word of this comes to your ears, then let this thing be looked into with care, and if there is no doubt that it is true, and such evil has been done in Israel; 5 Then you are to take the man or woman who has done the evil to the public place of your town, and they are to be stoned with stones till they are dead. 6 On the word of two or three witnesses, a man may be given the punishment of death; but he is not to be put to death on the word of one witness. 7 The hands of the witnesses will be the first to put him to death, and after them the hands of all the people. So you are to put away the evil from among you.

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.