This is to be cast out from a group and to be refused association with its people. In the OT people , such as those with leprosy-type diseases were excluded from the community for practical reasons whilst others were sent ‘outside the camp’ [exiled] for misdemeanours (Lev 13:45,46). Jesus however, associated with those rejected by society. He showed love and spoke powerfully into their lives, bringing about a transformation of character (Mk 2:15-17; Jn 4:7-18).
Jesus reached out to include not reject
and influence the whole, the sinful lifestyle of the unrepentant person will affect other believers (1 Cor 5:6-8). At no time should gross sin be excused or tolerated by overlooking it with incorrectly understood grace. Error must be exposed, and combated by the truth, but with the emphasis on restoration (2 Cor 5:18-20; Gal 6:1).
The purpose of excommunicating an unrepentant, defiant sinner is not public shaming or judgement, rather it is doing what is best for them and the church as a whole with the objective being they will see the error of their ways and turn back to the Lord. As soon as there is repentance the excommunicated believer should be welcomed back into the warm relationship with the church, although there may be for the need for ongoing input into the person's life to enable them to function.
If there was as much effort put into reconciliation and following Christ’s example of restoring relationship between God and mankind as there is in excommunicating people who ‘don’t fit’ into another’s interpretation of doctrine, it would be a powerful witness to those who view the church as a bunch of hypocrites.
Relationships can break down with the alienation of friends because of a strong differing of viewpoints about inconsequential issues, either about life in general or some spiritual matter that is magnified out of proportion. While there are spiritual principles that should distinguish the lives of believers and standards are to be upheld these are normally dealt with through addressing the issues in humility with those involved. Much of the segregating and shunning in society today is because of offences with little concern about restoration.