Sometimes pregnancies happen in very unusual places. Now, usually when people say "extra-uterine pregnancy" or "heterotopic pregnancy" or "ectopic pregnancy", they're referring to pregnancy in the fallopian tubes. The problem with a tubal pregnancy is that the fallopian tube doesn't stretch like the uterus does, and as the baby grows the tube can burst and hemorrhage. The baby doesn't survive to term.
However, far more rare and interesting than tubal pregnancy is the condition where the egg implants somewhere in the abdominal cavity.
Recently a case of extrauterine pregnancy made the news under the headline "Miracle Baby 'grew in liver'".
An interesting story I heard once, although I can't seem to track down a published report, was of a pair of fraternal twins; one implanted inside the uterus, as usual, but the other implanted on the outside of the uterus. Nobody noticed until after she had the first baby but the second wasn't coming. Her uterus was empty, but still had a baby-sized lump inside.
But how does the baby get there?
While eggs from the ovary typically go into the fallopian tube and from there into the uterus, they don't, strictly speaking, have to. The fallopian tubes aren't actually attached to the ovary, and the egg may just not make it that far.
Now, the ovary is certainly close to the fallopian tube, and there are little fringey things called fimbriae that help to move it in the right direction, but every now and then an egg gets lost and ends up implanting somewhere else - in this case, on the liver. Sonograms don't always pick up the fact that the baby is not in the uterus, especially if you're not looking for it (extrauterine pregnancies carried to term are pretty rare). The baby is, of course, delivered by caesarean section.
Extrauterine pregnancy is considered very risky for the mother. (For
comparison, the maternal mortality rate for a regular old-fashioned
pregnancy is 1 in 1000, or 0.1%; another source gives the risk of
abdominal pregnancy as being ninety times that of the regular kind).
Furthermore, only about 5% of implanted abdominal pregnancies result in the
birth (by caeserian section) of a viable baby.
The uterus is a specialized organ, and one of the things it does so well
is deal with the large, 8-inch wound left when the placenta separates from
the uterus after the child is born. Other organs that a baby might attach
to, such as the liver or intestine, cannot take that damage as easily.
When the baby is removed, the surgeons are careful to leave the placenta in place, for just this reason. Risks include hemorrhage, infection, toxemia, anemia, disseminated intravascular coagulation], pulmonary embolus, and "the formation of a fistula between the amniotic sac and intestine caused by penetration of fetal bone".