After unprotected sex, in order to prevent pregnancy you need to use emergency contraception. Like (from MOST effective to LEAST effective) the IUDs, Ella, or Plan B and its generics. Learn about which emergency contraception is best for you
here.