I had school dances, homecoming, or prom every year from middle school through high school. How and when did the tradition of school dances start?
The existence of a prom, as a social function for young adults, seems to be traced back to an offshoot of the debutante movement placed in high schools. Official coverage by schools in yearbooks and such does not really appear until the 1920s and 1930s, but there are references to "promenades" and "proms" as early as 1894, according to Karal Ann Waller, in "Debutante: rites and regalia of American debdom" (2004).
The idea likely took real root in the 1920s and 1930s. Schools for adolescents became more common in the 1920s and 30s and attendance at these schools rose. Generationally, there was in increasing number of young people during these decades, and people from lower- to lower-middle class families were increasingly seeing education as a way for their children to become socially mobile. The new, modern "high school" increasingly became a venue through which teens (a new theoretical cohort of "in between" aged individuals who were neither children nor working age) expressed sexuality; the schools created (both purposefully and not) a culture in and of itself that promoted mingling between the sexes.
But yet, this could not go unrestrained - schools couldn't in good conscience bring young men and women together and have them wildly experimenting on each other's bodies: that would be a terrible rip in the moral fabric of society! Especially given the fact that in the 20s and 30s, girls outnumbered boys, there was a concern that premarital sex would be commonplace. Dances were a safe way to house this type of sexuality, give it a release valve under the close supervision (often of ministers and police). There were obviously concerns, and many criticized rampant sexuality at these dances, but there is no reason to believe that they were anything out of control. In the case of single-gender schools, pairings between an all-boys and all-girls school for a common dance was a regular occurrence.
The importance of it was often underscored by the youth themselves, and I think this is the most pertinent answer to your question: it was not until the 1920s and 30s that students themselves understood high school dances as important. Boys at school "should know how to dance," according to one schoolage boy. "Dancing" was more commonplace in the 1920s and 30s, both for reasons associated with the rising importance and availability of commercial leisure, and ideas of controlling youth sexuality.
Hope this answered your question. For more, see:
Marling, Karal Ann. 2004. Debutante: Rites and Regalia of American Debdom. University Press of Kansas.
Comacchio, Cynthia R. The Dominion of Youth: Adolescence and the Making of a Modern Canada, 1920-1950. Wilfrid Laurier Univ. Press, 2006.