Except as otherwise provided by law, children whose parents have not been legally married, in contemplation of chapter 572, shall be designated as children whose parents have not been married to each other at the time of the children’s birth, provided that any person, who in writing duly acknowledged before an officer authorized to take acknowledgments declares himself to be the father of those children, shall be compellable to provide those children with necessary maintenance and support and to pay the expenses of the mother’s pregnancy and confinement. The mothers in all cases shall be compellable to maintain and support them during their minority.