It seems that there was a person in the church who was persisting in a matter of sexual immorality, and Paul told the leaders that such continued sin by a professing believer was not to be tolerated within the church fellowship. Today, Bible believing churches still utilize this type of disciplinary action when such circumstances warrant. To protect the church from further infection by such sinful behavior. Paul reminded them that it was one thing to be among immoral people in the world, but it is not acceptable to fellowship with immoral people who profess to be Christian brethren. Persons in the church fellowship who resist correction in any of the immoral behavior mentioned, are eligible for expulsion.
Excommunication is never the first choice for the church.
The Lord is a reconciler and wants His church to restore people whenever possible. But despite our best efforts, there are times when loving correction is not accepted and fails to alter communicable sinful behavior. In those cases, God requires that such persons be removed from the fellowship so to prevent sin from spreading, and to impress upon them their need for repentance. Jesus used the metaphor of a spreading infection to warn us from withholding personal sin in any area of our life. Similarly, if the infection of sin is allowed to spread unabated within the body of Christ, it will bring gangrene that will destroy the whole body.