Will you get pregnant if he only thrusts inside the vagina a few times and then ejaculates when he has taken his penis out?

You can never say for certain that you will get pregnant or not, but if the penis enters the vagina then yes you could potentially get pregnant. Some people think that the "pull out" method is effective birth control, and they are wrong. The penis will excrete semen without ejaculation. It release a lubricating like substance when erect, and that could potentially contain semen.