Dear @kathy,
Welcome back to the Wefugees Community and thank you for reaching out to us.
When a married woman is giving birth to a child, the (still) husband will be the legal father of the child. I am not an expert on family law, but as far as I know, you are are right that as long as the divorce is not finalised, this rule will also apply to a divorcing couple. However, I would strongly disagree that the child "belongs" to the legal father - most probably your friend and her soon ex-husband share the custody for now. I assume that the child support, the custody, the right for contact etc. are subject of the divorce procedure as well. Does your friend have a lawyer? I read that the divorce in Germany in general requires at least one hired lawyer to submit the divorce to the court. In case your friend does not have a lawyer, I hope that she gets or is planning to request support from the "Jugendamt", as I mentioned in an answer in one of your earlier opened threads.
However, there are many open questions in my mind, i.e. is the legal father taking care of the child and is he interested in being the official father? What about the biological father? Is he willing to acknowledge the paternity officially?
If I am not mistaken, the legal father, as well as the mother and also the biological father can challenge the existing paternity in court. Please be aware that a time limit of two years may apply.
I hope this helps to get a better picture on this topic. In any case, I would highly recommend to get support from an actual expert though. Contacting the local "Jugendamt" can be a first step.
All the best for you and your friend,
Meike