The sin of abortion gives the penalty of excommunication. But what about if you have sex with someone you know is taking the birth control pill, with the knowledge that the pill can cause an abortion. Is that considered cooperating in abortion, and does it incur excommunication?
You don’t give enough information.
It is anyway a grave sin to have sex with anyone outside marriage whether they are taking the pill or not.
The penalty of excommunication is for formal cooperation in a procured abortion. So the pill wouldn’t be included. (Plan B is another story)
Assuming the couple are married, there are guideline for the non-contracepting spouse including periodically trying to convince the contracepting spouse not stop using the contraceptive and not cooperating directly with the contraception. Under those circumstances, marital relations can continue without sin by the non-contracepting spouse. I think it moves from direct material cooperation to remote material cooperation.