In my country they just have a secure maternity ward with access to specialist care. After birth the child is allowed to live with it's mother inside a specially equipped prison. The child is in no legal sense detained as it is free to be sent to live with anyone else should the mother choose for someone else to raise the child.