When girls have their period their body releases substances called prostaglandins (PG) which cause the muscles of the uterus to contract. These contractions help to shed the lining of the uterus (the endometrium) which is what comes out during the period. Depending on how much PG is produced and the sensitivity of the body to it, these contractions can lead to muscle pain and cramping.
Medications like non-steroidal anti-inflammatory medications (NSAIDs) can reduce the number of PG produced and therefore reduce the contractions. Although all NSAIDs will be effective for period pain to some extent, some women will find particular ones work better for them than others. Using the NSAID as soon as she feels/knows her period is coming will help reduce the PG production from the start, and in many cases she can have a completely pain-free period.
NB: If she has serious pain that is debilitating during each period, it is important she sees her doctor because it may be a symptom of something more sinister going on.