In the past up through the 50’s, 60’s and even 70’s it was done on the grounds that single, pregnant women and girls were “fallen” or otherwise unworthy.
Nowadays it’s done as surrogacy: almost (*) always an exploitative practice, rich using poor in one way or another.
This is a variation on the surrogacy exploitation, gay men wanting to play at family just like their straight brothers and demanding a woman’s child from her.
I don’t care whether she “agreed”. Until she had actually given birth she wasn’t in a position to agree anything.
(*) I don’t know a case where it isn’t exploitative, but there maybe some.