This is more common than you'd think for girls this age.
Sometimes it's an infection, sometimes it's emotional, sometimes it's diabetes, and sometimes it's an over-active bladder.
Sit down with her and have a really non-confrontational talk. Let her know you're not mad, you just want to help...and need to ask her some questions to find out if she might need some medicine to help her go potty right. Ask her what you can do to help. Get her some panty liners she can wear. Explain that almost every girl in her school that's in 5th-6th grade wears these for a week each month. It's no big deal.
ask how it feels down there. ask how it feels when she's peeing. ask what color her pee is - dark or light. ask how she uses the toilet paper after (she should lightly tap once or twice and drop the tissue into the potty)
make sure she's not putting anything into her various holes down there like fingers or toilet paper. Make sure she only touches down there when her hands are clean. Make sure she's washing her private parts with ONLY WATER - not soap.
If she's not in pain when she pees, put off going to the doctor's office for about 4 days. (If there's pain, she needs medicine.) During four days, work on getting her to drink 8 glasses of water/Gatorade per day. Whenever you think about it, ask her to go drink 2 cups of water.
Buy her a watch with a timer alarm. Set it to go off every 2 hours. She goes potty when she hears the watch. She should go potty at certain times at school, too....so it's every 2 hours. This re-trains your bladder to hold it until the next time you have to pee. You pee everything out, wait one full minute and then pee everything out again.
Next time it's a problem, take her to the doctor's office. Tell your daughter that the doctor will want to look at her private parts to make sure it doesn't look infected. Explain to her that you will stay in the room with her and that it's OK because you'll be there with her and because it's a doctor who's helping to take care of her body.
It'll come back when she's stressed...but she can learn to control it. She might need the doctor's help - there's medicines for infections and over-active bladder.
Also let her know that you won't be mad at her when it happens...you just don't want people to tease her about it. so, tell her what she should do with the yucky panties when she has an accident. It's way better than her hiding them and you finding them later. yuck!