Yes, a woman can get pregnant even when ejaculation doesn't occur within the vagina. This is because pre-ejaculation fluid may contain some sperm.
Withdrawal of the penis from the vagina before ejaculation is one of the oldest methods of birth control. But fewer than 4 percent of adults in the United States use it as their primary method of contraception. The failure (pregnancy) rate is high. About 27 percent of women who rely on the withdrawal method of birth control become pregnant each year.