Angels were, in fact, the subject of long and thoughtful discussions among scholars and / or theologians during the Middle Ages. Medieval scholars or Scholastics generally regarded angels as living spirits that were / are not enclosed in flesh.
Such debates, amongst other issues, revolved around the precise nature of the angelic body. For example, medieval theologians and / or scholars discussed the nature of this body in connection to physical space. Here we may point to a question by the famous philosopher-theologian St. Thomas Aquinas (1224-1274). In his Summa Theologiae he asked of „whether several angels can be in the same place?“
But medieval Scholastics and / or theologians almost certainly never debated about how many angels can dance on the head of a pin. This claim apparently emerged among anti-Scholastic thinkers during the early modern period because they tried to caricature and ridicule Scholastic thought.
The first to claim that medieval scholars had really discussed this was arguably the 17th-century English philosopher Henry More (1614-1687), who was part of the Cambridge Platonist school. More aimed to demonstrate the absurdities of high Scholasticism by referring to the „ridiculous fancies of the Schools“. Furthermore, he mentions Scholastic discussions regarding angels as well as the question „how many of them booted and spurred may dance on a needle’s point at once(?)“.
Eventually, this claim was spread by a later edition of the popular work Curiosities of Literature. It was compiled by Isaac Disraeli (1766-1848), the father of the British Prime Minister Benjamin Disraeli.
Bartlett, Robert. The Natural and the Supernatural in the Middle Ages. Cambridge (et al.): CUP, 2008.