It’s usually not a good idea to ask a woman if she is pregnant. (And it’s an even worse idea to ask someone who is not a woman if they are pregnant).
Partly because pregnancy is considered to be private. People who want people to know they’re pregnant usually tell people; they’re not usually waiting to be asked. Asking can put someone in the awkward position of having to either lie or tell you information they’re not ready to make public.
It’s also a question that can go badly because weight is a sensitive topic for a lot of women. Because of the way our culture puts pressure on women to be thin, the thought of looking fat is humiliating to a lot of women.
And saying “Are you pregnant?” can sound like saying “So, I’ve noticed that you’re getting fat. Is there a socially acceptable reason?”. That’s likely to feel humiliating to a woman even if she is pregnant, but especially if she is not. And that’s true even if you don’t mean it that way, and even if you’re known to be a proponent of body acceptance.
It’s a sensitive and often painful topic. So it’s probably better not to ask.