It is not uncommon for children to have occasional accidents (awake and asleep) until they're 9 or 10. If it started up suddenly, or is regular now when it hadn't been before, look to some major upset in her life that has shoved her backwards in her development. A major move, a close friend moving away, a new school, the loss of a favourite teacher or relative... all of these are sufficient to stall a child's forward motion for a few months.
It is vital not to make a big deal about this -- and for you to separate your ego and pride from her bladder control. You have to be able to handle this with a minimum of fuss, or you will amplify whatever shame and anxiety she is already experiencing. She knows it's embarrassing, you certainly don't need to tell her that.
If it becomes common, supply her with diapers. Diapers aren't to keep anyone's bottom dry (or to shame anyone), but to minimize laundry and upholstery cleaning bills. Continent people use toilets, incontinent people use diapers -- at any age.
Frankly, the school day may be terrifyingly stressful (this year because of a frightful teacher or a seatmate who is tormenting her) and she may have accidentally (ha ha!) worked out that wet pants get her a reprieve for the day. Don't be surprised if she hasn't told you about this... the common implied 'fact' that parents know all about what kids are doing when they're not around leaves kids with the very strong impression that their parents already know all about what's happening when they're away at school, so she may not have mentioned it simply because she expects you to know everything.
If she's being tormented (by anyone) she needs your support, if in no other way than assurance that if she needs to come home she can go to the nurse and tell her she doesn't feel well, and you'll come right away.
In my opinion, children need to know that their parents will come right away.