“your eye is not to pity him.” This is a Semitic idiom that means, “you must not pity him.” In the culture, the “eye” reflected the character or attitude of the person, so for a person’s eye to pity someone was for the person to have an attitude of pity, which would then lead to having mercy and sparing the person. But God knew that idolaters in the camp of Israel would eventually lead many people away from God and to everlasting death, so He commanded the death penalty for such people. If someone wanted to turn away from Yahweh and worship idol gods, they were free to leave and go live among the pagans, but they were not free to stay in the camp of Israel and influence people to turn from Yahweh.
The New Testament tells us that when a person in the congregation acts or teaches in such a way that they overthrow the faith of other believers, they are to be put out of the congregation (cp. 1 Cor. 5:9-13; 1 Tim. 1:20; Heb. 12:15). [For more on idioms involving the eye, see commentary on Proverbs 22:9].