It isn't possible to prevent an ectopic pregnancy as it can affect any woman. However, you can reduce your risk of having an ectopic pregnancy if you take measures to protect yourself against sexually transmitted infections, which can damage your fallopian tubes, and quit smoking.
Attribution: BUPA