I have popped a woody a couple of times while working out, thought it may have more to do with checking out some hot guy who's there and less to do with actually working out,
It often happens with us doing intense ab exercises, depending on the intensity and duration.
So not in gym class, but if you're taking gymnastics or ballet classes for many hours a week, and you're a girl, your abs are probably going to get strong enough that they'll stimulate your insides to orgasm.
Less likely from five hours a week, but by age 12, competitive gymnasts and professional path ballet dancers are often training 15 to 30 hours a week, even more sometimes.