I believe Paul's point was that we shouldn't shun "unbelievers", else we'd need to leave this world. However, Paul plainly writes:
"But now I am writing to you not to associate with anyone who bears the name of brother if he is guilty of sexual immorality or greed, or is an idolater, reviler, drunkard, or swindler—not even to eat with such a one." - I Corinthians 5:11 (ESV)
Paul is telling the church that if a member ("brother") is engaging in continued and willful sinful rebellion in the areas of sexual immorality, greed, idolatry, reviling, drunkenness, or is a swindler after confrontation, correction, and counseling... we shouldn't eat (fellowship) with such a one.
Now, it is important to realize that when this was written churches didn't gather as so many churches do today. They didn't have church buildings with a steeple, parking lot, pews, offices, air conditioning, and a sign outside. They primarily met in homes. They gathered around the table to eat the Lord's Supper The meal and fellowship was organic and natural, Scripture was taught and discussed. Prayers were requested and given. Songs and hymns were sung. To be excluded from the meal, was to be excluded from fellowship.
But I would like to emphasize, this was only applicable to willful, continued, rebellion and the areas of sin noted. If the "sinner" (or guilty party) was open to counsel and correction there was no need to excommunicate or shun the individual.
The purpose was to shun the individual to bring them to the realization that they are cut off in order to inspire repentance. Upon repentance, the shunned one was to be lovingly welcomed back into fellowship.
At least, this is my understanding.