An ectopic pregnancy occurs when a fertilized egg attaches to the fallopian tube, and for this reason, it is commonly referred to as a tubal pregnancy.