My three year old daughter also masturbates. We have talked to her doctor about this he said that when a child first realizes that it feels good to touch themselves there they will do it quite frequently at first and they are to young to know that they should do that when they are alone because they do not feel embarrassed like we do yet. They will eventually stop doing it so often and eventually they will hide when they do it. By making a big deal of it they are doing it out of defiance if you don't make a big deal of it, it won't be on their mind and they won't do it so much. They will "grow out of it" eventually. And it is quite normal.
First, be sure to have her evaluated medically, to be sure there is no inflammation, irritation, or other physical problem. If all is OK from that perspective, set limits on her behavior in 'public' settings (i.e., in the presence of others), and tell her that such behavior must occur while she is alone. Generally, this turns out to be no problem at school, because children are otherwise occupied. You'll notice that at home, when your daughter is occupied, she will likely not masturbate.