I heard that some things (like getting an abortion or attacking the pope) have the penalty of latae sententiae excommunication. What is that?
Latae sententiae excommunication means that the person becomes automatically excommunicated as soon as the offence is committed.
From the Catholic Encyclopedia:
The same immediacy applies to any other penalty marked latae sententiae; the term is not limited to excommunication.