You can only get pregnant if semen gets inside the vagina. Since the anus isn’t connected to reproductive organs, anal sex can’t directly cause pregnancy. But it’s still possible for semen to get into the vagina during anal sex. It can happen if the guy ejaculates into or near the anus, and the semen leaks from there down onto the vulva. Semen on hands or fingers could also put it closer to the vulva, also.
Wearing a condom during anal sex can reduce your risk. And don’t forget: Anal sex is also a high-risk behavior for spreading many STIs.
Hope this helps.