Op with my first baby I was moved from a permanent employee to freelance contract just as I found out I was pregnant.
I did my research and found out the law protected me somewhat in this situation (entitled to mat leave pay based on the earning level of specific weeks in your pregnancy).
I didn't disclose my pregnancy until after the end of that specified period, and was lucky a client driven project kept ,e busy during it, so my mag leave entitlement was similar to the amount I would have got anyway.
In terms of job hunting, I'd started that before I found out I was pregnant. Was in several processes during the first trimester, including one with some tough technical tests when I had bad morning sickness. Didn't get that job but don't think it is the reason.
I would not have declared my pregnancy to any of them until they made me a firm offer.
The one I wanted the most dragged on. First discussion when I was 6 weeks. Four or five interviews in all which stretched out until I was about 28 weeks (luckily during a cold winter. I was showing by then but wore a large black jumper with jacket over, the guy didn't ask so I didn't declare). Then silence.
Thought it had fallen away tbh but turn out just to be a slow HR process. My prospective boss got I. Touch to say they were ready to make me an offer when I was 32 weeks pregnant.
I asked to meet him for coffee (wanted to gauge his reaction) and explained. Told him I was still in. But needed some time. He took it well no told me to contact him after the baby arrived.
I emailed him about a month after I gave birth. He said then 'I'm definitely hiring, I have the hr stuff worked out now. You are my top choice candidate, I know you just had a baby, tell me what you need to make this work.'
We spent a while negotiating terms and planned I'd start two days a week when the baby was 5 months, building up to four days a week. But then I had a serif and sudden illness. So postponed my start date and went in straight to 4 days a week when dc1 was seven months.
It was tougher going into a new job than back to one I knew, but I had no going back option and in the long run it worked out great.
You can do it OP