Child custody, support, and visitation rights are decided absent any consideration for the parents. The court's only overriding concern is what is in the best interests of the child. But the closer these disputes are to the birth of the child, the harder they are to resolve. This post will go over the unique issues inherent to establishing child custody rights over a newborn child.
In a perfect world, parents would work out visitation and custody issues before the birth of the child. Addressing these matters after the fact is much more complicated. Part of the problem is that a father only gains parental rights over a child once paternity is established.
If both parties agree to paternity, then they can stipulate to it, but if there is a dispute, the father may need to sue for a DNA test to prove that he is the biological father. Prenatal DNA tests are available however they rely on the acquiescence of both parties to be administered.
Part of the issue for apportioning custody over newborns is that the court does not know what the child needs. Older children have the benefit of school, schedules, an established social circle, and they can tell the court their opinion. Newborns have no history and are incapable of expressing an opinion. The lack of any context from the point of view of the child forces the court to extrapolate based on the parents.
If you recently had a child, then you may want to speak to a lawyer. As illustrated above, gaining child custody rights to your child, if you are unmarried, isn't automatic, even if your name is on the birth certificate. An attorney can go over what it takes to secure your visitation rights. You don't need to fight to defend your rights alone; a lawyer can help you.