The mental health services are very very unlikely to inform social services about the pregnancy. They would have to have very good reason to break confidentiality.
And simply having a psychiatric diagnosis is certainly not a good reason or even a reason at all.
If social services were informed every time anyone with mental health problems became pregnant or impregnated someone, they would have no time to do anything other than record the messages.
As daffy says, why would it be assumed that someone with mental health issues would represent a danger to a baby ?
The percentage of people with mental health issues is huge.