What should [the professor] have done?
Depends on the actual extent of the disruption. But probably he did the right thing.
Should students be prohibited from bringing babies to class.
Of course not.
There is no such thing as a perfect learning environment
Even assuming all sources of distraction eliminated, I doubt that you'd be able to focus 100% on the input provided by the lecturer and that you'd be able to pick up and digest every bit of information presented after one time hearing it during lecture time. If your learning strategy relies on others spoon feeding and guaranteeing "perfect learning conditions" for you all the time, good luck to you.
Of course, the student should take the baby out of the classroom if it constantly requires attention. However you should be able to ignore the little noises happy babies usually make. Not all children require being looked after all the time. If they do, it should probably be taken care of outside the classroom. If they don't, there's no reason to outright ban them for some minor distractions they may or may not cause.
Not all distractions are created equal and regulations regarding the usage of entertainment technologies obviously do not apply here. A balance need to be found requiring a certain degree of thoughtfulness and tolerance on all sides. But you need to accept the fact, that you don't live in a world without children.
Also parents deserve formal education
To those who argue the normal way of life means education first, family second, and it's their own fault not adhering to that, I say that for academics there will never be a better time to reproduce. Do you want to take a break after completing your master's or phd? Do you rather want to take a break during your postdoc or professional career phase in the industry? Do you want to buy and pay off a house first? You can't wait until retirement to start a family, as a woman at least. Also note that most people probably will find it easier to share the little money they have as a student with a baby, rather than cut their household income almost by a factor of two after getting used to a dual income, no kids lifestyle.
It is as essential for parents to receive formal education, as it is to you.
Probably the situation is at least as inconvenient for them, as it is to you. So you can expect them to have a strong incentive already to get external child care available whenever possible.
As parents usually have it harder than you all the time, it seems unfair to make it even harder for them, just to avoid causing others to notice there is a world outside beyond the lecture topic.
Diversity is good for you
You are lucky, because it seems to be possible to participate in the education provided by your university even as a parent.
Because that means that there are people promoting a demand for a family-friendly environment and likewise family-friendly employment conditions, that might benefit you one day.
In the long term (evolutionary sense) it's undesirable to remove the academics from the gene pool. Similarly, it's undesirable to remove the parents from education or the workforce.
In the short term, I'd suggest you to either ignore the situation (as the professor did) or to get to know the parent, talk about how she feels about this, what her options are. Ideally in a non-offensive way. Maybe this is different in the US, but here in Germany every sizeable university has programs for the promotion of a family-friendly culture at the university and for the support of working or studying parents among students and staff. If there is none, you could suggest to establish one.
A family-friendly culture starts by recognizing children are there and by making offers to those involved to improve the situation for everyone. If there are no options outside the classroom, they will continue to stay inside. It's the same as with cyclists without proper cycling infrastructure. They need to make use of whatever they can find.