There are a couple different plants that were commonly used to prevent pregnancy or stop it in its first few days.* Silphium, so famous in earlier centuries, was extinct other plants were known to work as well. Pennyroyal seems to have been the most widespread, but Queen Anne’s lace (also known as wild carrot) and rue seem to have been widely used as well. Some plants, like asafetida (a relative of silphium) have been proven to be somewhat effective, but not totally so. Pomegranate was also believed to act as a contraceptive, but that has since been disproven. The problem with most of these was how toxic they were. An overdose could easily result in far more serious health problem, or even death.
Not that these things were always used for contraception. Many of them were known to bring on menstruation, which could be done to prevent a pregnancy, but it could also be used to make sure of fertility (if, for example, a woman hadn’t been having periods in a while) or to easily remove an already dead fetus from the body.
Another method of contraception was to have sex in such a way that wouldn’t get someone pregnant. Coitus interruptus is known to have been a common method, but pennitentials and other texts also mention oral and anal sex, among other ways. Some people tried wearing amulets and charms or jumping up and down after sex. More effective than either of these things was the insertion of a sponge or some other barrier into the vagina. Regardless of the Church’s (rather formulaic) disapproval, medieval people knew and practiced a wide variety of contraceptive methods, some of which were more effective than others.
*Most medieval people who had opinions on the subject that we know about seem to have considered the fetus a person either after 40 days or once its mother felt it move.
Brundage, James A. Law, Sex and Christian Society in Medieval Europe. Chicago: University of Chicago Press, 1987.
Birth Control and Abortion in the Middle Ages - Medievalists.net
Contraception (Sample article from Women and Gender in Medieval Europe: An Encyclopedia) - Routledge