Hello, welcome! First, I'll honestly answer question: Yes, it's legal.
Now to that I'd like to add something. LOTS of things are legal that aren't safe, that are horrible ideas. Where I live it's legal to ride a motorcycle on the highway without a helmet. Pretty much everywhere it's legal to get drunk while you're pregnant, smoke while you're pregnant, even though those things are very dangerous. On the flip side, there's some laws on the books that are insane: in some municipalities it is still, to this day, on the books that it's illegal to swear or walk on a certain side of the street. So, laws, yeah, they're not the greatest decision maker.
Facts are. Facts are that taxies are no different than any other vehicle, and your child is at just as much danger as in any other vehicle. Perhaps more so because you don't know that taxi driver nor his driving habits.
If you tell us your child's age, torso height (measure from butt to shoulder) and weight, we can help you find the easiest option to use. there are some really travel friendly options out there that work depending on the child.