If someone has been excommunated from the Church, can they be reconciled back by confession? For examples C 916 and C1398 about abortion and grave sin.
The law on the remission of censures, of which excommunication is one, is complex.
The priest must have the faculty from the bishop to absolve from the censure in the case of a successfully completed abortion. Most do these days.
Other types of declared or imposed excommunication cannot necessarily be absolved in the sacrament of confession. Sometimes the remission is reserved to the Apostolic See (c. 1354, para 3) and there are only certain situations which can be treated in the sacrament (canon 1357 and canon 508). There is of course, the danger of death situation of canon 976.
Canons 1355-1356 describe the authorities competent to remit such a penalty. Generally (and this is very general), an ordinary (a diocesan bishop, vicar general, clerical religious superior with ordinary power, or someone to whom he delegated this power) would be involved.