If you get married before you have the baby who has legal rights to the baby my husband or the father?

Depends on your state. In MI, the legal father of the child is the mother's husband. If your child's father is not going to be your husband, do the right thing and let him be involved.