If by "have babies" you mean gestate and give birth to, then the short answer to this question is yes, men can have babies.
If you're surprised by this answer it probably has more to do with what you mean by man. Usually when people talk about a man they are talking about a person whose body has a penis, testicles, scrotum, and sperm. And when they talk about a woman they mean someone whose body has a vulva, clitoris, uterus, and eggs.
But not all men have sperm, and not all women have eggs. Most do, but not all.
The confusion here is a misunderstanding about the difference between sex and gender which leads people to believe that all men have penises and sperm and all women have eggs and uteri (and also that there are only those two options). This isn't the case. It's true that most men have a penis and have sperm, and most women have eggs and have a uterus, but not all of us do.
Some men are born with bodies that have a uterus and eggs, and some women are born with bodies that will eventually produce sperm. And since doctors don't look much farther than our genitals when we're born, some of us are born with bodies that aren't easily categorized as male or female.
The body you're born into does have some relationship to the gender that you identify as as an adult. But they aren't always the same. There are lots of different words people have found in trying to describe how they feel about themselves and their body in relation to both sex and gender. No words are perfect but to give you some examples, people whose gender identity doesn't match what they were called at birth may identity as transgender or transsexual or gender non-conforming, or gender variant, or genderqueer, or one of many other terms that people have found to describe how they actually feel about themselves and their bodies, not how other people expect them to feel.
There has also been a term developed to describe people whose gender identification matches the thing they were called at birth. They are sometimes called cisgender.
Because almost all of us are raised with incorrect information, that there are only two kinds of sex and two kinds of gender and that we are all born as one and die as one, it can seem impossible for a man to have a baby. But it isn't. The most public and vocal group of men who have babies often call themselves Trans dads.
If you're interested in learning more about Trans people parenting, I highly recommend this 10 minute documentary, Transforming FAMILY which is available for free online.