I think you are confusing two different things.
You remain fertile until menopause is finished, which could easily be 50+.
But, as you get older, the likelihood you are producing abnormal eggs increases. If these eggs are fertilised, they are less likely to implant, more likely to result in a miscarriage (and also more likely to result in chromosomal conditions such as Down's Syndrome).
Lots of people are still fertile and able to have a healthy baby at 38. Some are not. And many people will find it takes longer, and involves more miscarriages, to get there.
Once you are into your 40s, it is very likely you will keep on ovulating, but if the eggs are fertilised, many of them won't implant (and you won't know they ever fertilised), or you will miscarry - early on, you may not even know this has happened.
The reason it's worth being nervous about pregnancies into your late 30s/40s isn't that you couldn't conceive. It's that you are so much more likely to experience a miscarriage.