There are two types of excommunication. The faithful may help a person excommunicated Vitandus and not incur the excommunication themselves. The excommunicatee may still be helped by the faithful - those in communion with the Church - in the event she or he, say for instance, has a heart attack or is dying of thirst or is on fire; they can put it out without themselves becoming excommunicated. Vitandus is what is called, "reserved to the local Ordinary" or bishop of the diocese in which the offense happens. It often costs nothing other than eating a little crow and doing a little private penance to get off the hook. The local Ordinary may, and in the US often does, delegate his authority to absolve from a Vitandus excommunication to certain select priests. Vitandus excommunication is incurred by having an abortion, two Catholics getting married by the civil authorities, using birth control, striking a priest or religious, not sending your Catholic children to Catholic schools, etc.
Invitandus excommunication, on the other hand, is really serious. The faithful must avoid an Invitandus literally like the plague or they might incur it themselves. Pope Gregory VII excommunicated invitandus the German Holy Roman Emperor Henry IV. Henry's Imperial power was so threatened by this form of excommunication he crossed the Alps in midwinter to beg Gregory VII to lift it. A person incurs Invitandus excommunication for trying to kill the Pope or a Bishop, for desecration of the Holy Eucharist, or any of the Sacraments, destroying or desecrating a church or a sacred relic, stealing from a church or, if one is a Catholic politician or public figure, publicly saying something which goes against the faith or morals decisions of the Pope or a Council - like that it's OK to practice birth control, use the pill or have pre-marital sex or that Jesus Christ is not physically present under the appearances of bread in the Holy Eucharist or that Mary wasn't a virgin. If you're excommunicated Invitandus and are on fire a faithful Catholic can't piss on you without getting excommunicated himself. Getting off this hook takes a lot of dough and a lot of heavy penances - Henry IV.