To be honest, I suspect the teacher was harrassed and is using the shorts excuse as a get out. I may be doing him\her a disservice.
Getting young children ready for PE is a nightmare. There are always children who can't undress themselves, untie laces etc. Before you know it, half the PE time is gone.
I don't mean your GD, but the teacher was probably distracted and didn't really think about the consequences.
You have to ask yourself if it was just a one off, is it worth making a fuss? I'm not in any way condoning what the teacher did. They should have checked your GD was suitably dressed. The minute it was obvious she was in her underwear, teacher should have told GD to get dressed again.
To this day, to my utter shame, I remember being really harrassed and a child who was was constantly out of his seat came out to my desk and interrupted for the umpteenth time. He muttered something, to which I replied, " Oh, that's nice, now go and sit down." What he had actually said was" My granny's house burned down last night." ☹️ We are all human.