First of all, it should be clear that Hijab is meant to preserve Muslim woman’s dignity. Like all other Shari`ah-based commands, Hijab should be given due care, for it brings about countless fruits and wards off evils.
In his response to your question, Dr. Muzammil Siddiqi, former president of the Islamic Society of North America (ISNA), states:
“It is necessary for an adult Muslim woman to wear Hijab whenever she is in the presence of non-Mahrams (marriageable men). Referring to this, Allah Almighty says: “And tell the believing women to lower their gaze and be modest, and to display of their adornment only that which is apparent, and to draw their veils over their bosoms, and not to reveal their adornment save to their own husbands or fathers or husbands fathers, or their sons or their husbands’ sons, or their brothers or their brothers’ sons or sisters’ sons, or their women, or their slaves, or male attendants who lack vigor, or children who know naught of women’s nakedness. And let them not stamp their feet so as to reveal what they hide of their adornment. And turn unto Allah together, O believers, in order that ye may succeed.” (An-Nur: 31)
He Almighty also says: “O Prophet! Tell thy wives and thy daughters and the women of the believers to draw their cloaks close round them (when they go abroad). That will be better, that so they may be recognized and not annoyed. Allah is ever Forgiving, Merciful.” (Al-Ahzab: 59)
There is no exception for school, sports, etc. If a grown up girl goes to a school where there are male and female students, then she is obliged to wear the Hijab.
Muslim girls should have sports with girls. Sports that brings about intermingling between men and women are not allowed [for fear of temptation and immorality]. Muslim girls who play with other girls and no non-Mahrams watch them do not have to wear Hijab.”