Keep in mind that when toddlers touch themselves, it’s not about sex — it’s about curiosity: Toddlers learn about their bodies by investigating them. Plus, even at a young age, touching themselves feels good so, without thinking twice, they do it often.
What they have no concept of is "right time, right place." So, while being as matter-of-fact as possible (as opposed to shocked or disgusted), you just need to explain to her that touching herself on that part of her body is something she should do when she is alone in her room. You may need to gently remind her a few times until she fully comprehends the concept.
If your toddler still continues touching her genitals freely after that conversation, however, you may want to speak with your pediatrician. It's possible she’s doing it because she's uncomfortable due to a health issue, such as a urinary tract infection — or maybe this is her way of telling you she needs to use the bathroom.