If the mother has sole physical custody and shares joint legal custody with the father the two never married if the mother dies can her husband who is not the baby's biological father assume custody?

No, unless the baby's biological father relenquishes his parental rights, he would get custody of the child if the mother dies, not her husband. The biological father must sign his rights away to the mother's husband.