I had a successful pregnancy age 42 - I was a bit overweight didn’t gain any weight until the very last weeks of the pregnancy.
There is plenty of exercise you can safely do during pregnancy- yoga, swimming and walking should be ok, perhaps gentle cycling.
The key is to move, manage your diet carefully to be ultra healthy and make sure you don’t increase your calorie intake at all - you should gently maintain or in early months can lose weight as the baby grows.
Unless you are very heavy or advised by a medical professional - I definitely wouldn’t try to actively lose weight by dieting.
Once the baby arrives - that’s when you capitalise on your weight loss. I started walking 2miles a day a week after the baby was born and by week three I was doing 4 miles every weekday. A few months later I added a brisk swim on Saturdays. Once that’s going well you can other things you enjoy.
Pregnancy can be quite anxiety-inducing as an older mum, so being healthier made me feel I was doing something positive to prepare.
One upside of all the walking was that once dc was toddling I got him on a balance bike so he could ride while I did my long walks. We have a lot of paths without traffic near us so it was stress-free, screen-free entertainment. Dc is now 7 and bike mad, so we spend a huge amount of time cycling - he likes long rides of 15miles+ and it’s a good hobby to have in your late 40s as you can carry on cycling indefinitely.
A few months ago someone on the school run described me to a mutual friend as “that sporty mum” which was THE best compliment I’ve ever had as I’m not even vaguely sporty.
So just saying - you can do it. Having a baby in my 40s has been a wonderful experience and one I’m so grateful for.