Unfortunately, I know several girls/women that have tried to trap a man with a baby. Four of them (just off the top of my head) have admitted it to me! I have known it to work ... well, no times, yet ... but there is one that looks like it's going to happen, (the first baby is 5 and the second one is on the way) and I'm real hopeful that this marriage will first take place, and then work!
From what I have heard from those that did it, it was a way to get married, first and foremost. Second was to be able to keep the daddy forever in this nice, little married kind of format, because he was the one and she was in love. Most of them accepted the role of single parent pretty well and did their best to raise well-rounded kids. Only a couple haven't succeeded.
I have also heard as a reason for doing it was to get him away from some other woman who was "competition" for his effection. That really went badly, because he married the other woman!
I have two younger cousins, both of who are in their later 20's who swear the pregnancy was an accident. (And I believe them.) Both swore they didn't need the baby's daddy and neither fathers were around during the pregnancy. Now, one child is turning 3 and the other just turned 2. Both of them have reconciled with the father -- both reunions initiated by demands for child support after the baby was born!! It started with the visitation ... then "family" outings. I'm not saying either was a trap ... but both stated that they would love to be married to these men and doing the family thing, since it's already kinda started.
What usually possesses a girl/woman to do it? She thinks she's in love ... deep, everlasting, forever, soulmate kind of love. That's particularly sad when the girl is still a teenager, because she has no way of knowing. For more grow-up type ... mental illness is as good an excuse if any, I guess.