Then when he says, "and we charge you," he shows how they should relate to disorderly persons. And first, he sets out a rule; second, he explains it, at "for you yourselves"; third, he shows why the rule he has set out is necessary, at "for we have heard."
He says, therefore: Thus you live, and thus we have confidence, but because there are some wicked men among you, "we charge you, brethren," namely, you perfect, "in the name of our Lord Jesus Christ." For this has to do with prelates. "Announce to my people their wicked doings, and to the house of Jacob their sins" (Isa 58:1). "I will requi...re of you the blood of that man" (Ezek 3:18).
There follows the rule: "that you withdraw yourselves from every brother walking disorderly and not according to the tradition which they have received of us." The practice of avoiding wicked men was introduced in the church to prevent weaker men from being contaminated by associating with them. "Whoever touches pitch shall be defiled by it" (Sir 13:1). "A little leaven leavens the whole lump" (1 Cor 5:6). And for the healing of the sinner, so that his embarrassment might lead to his salvation. "There is an embarrassment that leads to sin, and there is an embarrassment that leads to glory" (Sir 4:25). And this should not be done indiscriminately, but with deliberation and maturity. "Gather yourselves, and by my spirit with the power of the Lord Jesus deliver such a man to Satan for destruction" (1 Cor 5:4). And thus it says here "that you withdraw yourselves."
But excommunication should only be inflicted because of some sin, because it says here "disorderly." And this is when something is evil in itself and against the order of the natural law, as the Gloss explains. "But let all things be done decently and according to order" (1 Cor 14:40). "All things that are from God are ordered" (Rom 13:1). Or because it is forbidden and against the teaching of the church. Hence he says "and not according to the tradition which they have received of us"; "hold the traditions, which you have learned, whether by word or by our epistle" (2 Thess 2:15).
Source: Commentary on 2 Thessalonians