Excommunication (n.) The act of communicating or ejecting; esp., an ecclesiastical censure whereby the person against whom it is pronounced is, for the time, cast out of the communication of the church; exclusion from fellowship in things spiritual.
Other things to consider from the Catholic Encylopedia:
2) "Those who efficaciously procure abortion." The fruitless attempt is not punished with excommunication; authors do not agree as to whether the woman guilty of self-abortion is excommunicated.
The right to excommunicate is an immediate and necessary consequence of the fact that the Church is a society. Every society has the right to exclude and deprive of their rights and social advantages its unworthy or grievously culpable members, either temporarily or permanently. This right is necessary to every society in order that it may be well administered and survive. The fundamental proof, therefore, of the Church's right to excommunicate is based on her status as a spiritual society, whose members, governed by legitimate authority, seek one and the same end through suitable means. Members who, by their obstinate disobedience, reject the means of attaining this common end deserve to be removed from such a society.
I. GENERAL NOTIONS AND HISTORICAL SUMMARY
Excommunication (Lat. ex, out of, and communio or communicatio, communion -- exclusion from the communion), the principal and severest censure, is a medicinal, spiritual penalty that deprives the guilty Christian of all participation in the common blessings of ecclesiastical society. Being a penalty, it supposes guilt; and being the most serious penalty that the Church can inflict, it naturally supposes a very grave offence. It is also a medicinal rather than a vindictive penalty, being intended, not so much to punish the culprit, as to correct him and bring him back to the path of righteousness. It necessarily, therefore, contemplates the future, either to prevent the recurrence of certain culpable acts that have grievous external consequences, or, more especially, to induce the delinquent to satisfy the obligations incurred by his offence. Its object and its effect are loss of communion, i.e. of the spiritual benefits shared by all the members of Christian society; hence, it can affect only those who by baptism have been admitted to that society.
Catholics, on the contrary, cannot be excommunicated unless for some personal, grievously offensive act
So, in essence a person excommunicates themselvs by thier actions and the Church lawfully, to those under the jurisdiction of the Church, declares and enforces the excommunication.