I don't think your daughter should have to shave her legs, of course not.
However, sadly she is growing up in a world in which women are expected to shave their legs. It is changing gradually as more women challenge the assumption, but still it is fairly prevalent. So if she chooses not to, she unfortunately may face similar comments in the future.
My daughter is 11 and currently chooses not to shave. She is tall with long legs and generally taken as older than her age, so it is kind of noticeable. I spoke to her openly about it and said, I totally admire your decision not to shave, more women don't shave these days, but equally be ready because some people may expect you to and make comments - it's wrong but may happen. I also told her if she wanted to shave or use some other form of hair removal I would get her the stuff.
I think if your daughter is getting older and is clear she doesn't want to shave then yes that is brilliant, but sadly she may have to toughen up a little. It's not right, but we have to prepare our children to live in the world that exists, as well as to shape the world they would prefer......
I am not sure the teacher will be able to do a lot - while not nice these comments are pretty standard I would think. But by all means mention it - she may be able to speak to the whole class about puberty and harmful gender stereotypes. Or something.