(1 Cor 5 NKJV) "It is actually reported that there is sexual immorality among you, and such sexual immorality as is not even named among the Gentiles; that a man has his father's wife! {2} And you are puffed up, and have not rather mourned, that he who has done this deed might be taken away from among you. {3} For I indeed, as absent in body but present in spirit, have already judged (as though I were present) him who has so done this deed. {4} In the name of our Lord Jesus Christ, when you are gathered together, along with my spirit, with the power of our Lord Jesus Christ, {5} deliver such a one to Satan for the destruction of the flesh, that his spirit may be saved in the day of the Lord Jesus. {6} Your glorying is not good. Do you not know that a little leaven leavens the whole lump? {7} Therefore purge out the old leaven, that you may be a new lump, since you truly are unleavened. For indeed Christ, our Passover, was sacrificed for us. {8} Therefore let us keep the feast, not with old leaven, nor with the leaven of malice and wickedness, but with the unleavened bread of sincerity and truth. {9} I wrote to you in my epistle not to keep company with sexually immoral people. {10} Yet I certainly did not mean with the sexually immoral people of this world, or with the covetous, or extortioners, or idolaters, since then you would need to go out of the world. {11} But now I have written to you not to keep company with anyone named a brother, who is sexually immoral, or covetous, or an idolater, or a reviler, or a drunkard, or an extortioner; not even to eat with such a person. {12} For what have I to do with judging those also who are outside? Do you not judge those who are inside? {13} But those who are outside God judges. Therefore "put away from yourselves the evil person.""
(1 Tim 1:19-20 KJV) "Holding faith, and a good conscience; which some having put away concerning faith have made shipwreck: {20} Of whom is Hymenaeus and Alexander; whom I have delivered unto Satan, that they may learn not to blaspheme."
(2 Th 3:6 NKJV) "But we command you, brethren, in the name of our Lord Jesus Christ, that you withdraw from every brother who walks disorderly and not according to the tradition which he received from us."
Sometimes rather than excommunication its called disfellowship or withdrawal. Notice in 1 Cor 5 how Paul says Christians are not to eat with a brother who is one of the things he mentions--if they cannot eat a common meal with such a person, how can they eat the Lord's Supper with them? That is what excommunication means "expelled from communion" because Christians cannot eat the Lord's Supper with a Christian who is in unrepentant sins of that sort as Paul mentions there.