In the middle ages, witches were supposedly people who sold their soul to the devil or who studied arcane texts to learn magic. But in modern pop culture (e.g. Harry Potter, Sabrina the Teenage Witch), witches are often depicted as a distinct species or race who inherit their powers, and normal humans cannot learn witchcraft. When did this change come about? The earliest example I can think of is the TV show "Bewitched" from the 1960s. Related, did any ancient civilizations hold the view that witches were a distinct race or type of being?
CHAPTER VI: The Devil Wishes to Perpetuate the Race of Witches. Argument. The infection of witchcraft is often spread through a sort of contagion to children by their fallen oarents, when these study to find favour with their Cacodemons by so doing. For the greed of Satan was ever infinite and insatiable: thus, when once he has gotten a foothold in any family, he is never known to relinquish it except with the greatest difficuty. And it is one among many sure and certain proofs against those who are charged and accused of witchcraft, if it be found that their parents before them were guilty of this crime. There are daily examples of this inherited taint in children, for the devil is always busy to increase the number of his own. And there can be no more fruitful means of attaining this end than by urging and compelling those who are already in his power to corrupt their children.
Therefore thou dost belong unto the race
Of witches or fairies [...]
Early texts on European witchcraft occasionally use the word "race" in the sense of "lineage" or "family" - but this is not strictly race in the way used today. The idea of "race" as a distinct species with unique capabilities is a later conception (I'm condensing and simplifying a lot here, so forgive me), and began to apply to fantasy and science fiction around the late 19th/early 20th century - and this is when you start seeing the emergence of "races" with supernatural attributes or abilities, as contemporary understanding of biology, anthropology, and eugenics becomes applied to subjects of aliens, mythological, and supernatural entities - so you get "races" of elves, dwarves, Martians, Kryptonians, etc.
Early examples don't always match up to our current conception of either race or witches. In The Worm Ouroboros (1922) by E. R. Eddison, for example, the Witches inhabit Witchland - but "Witch" in this context is closer to the 1920s understanding of "nation" than the biological conception of race - so the people of Demonland are Demons just as the people of Angleland are Angles.
Many 1920s, 30s, and 40s witches in popular fiction were more or less based on medieval accounts of witchcraft (especially as influenced by Margaret Murray's influential 1921 book The Witch-Cult in Western Europe) and the burgeoning "popular" conception of a witch as a generic worker of magic as popularized in the fairy tales of Andrew Lang and the Brothers Grimm, or the Oz books of L. Frank Baum beginning with The Wonderful Wizard of Oz (1900). Popular and influential fictional works include A. Merrit's Burn, Witch Burn! (1934) and Fritz Leiber's Conjure Wife (1943), which often emphasize that witchcraft is hereditary in the sense of being a capability passed down from generation to generation, usually on the female side - for example I Married A Witch (1942) has the eponymous witch as being a descendant of the "witches" burned at Salem.
So by the time you get to Bewitched (1964) the idea of witches as "a race apart" with supernatural powers is not a far stretch, from a fictional point of view. It's really just the fantasy counterpart of the science fiction concept of a mutant or alien with superhuman powers that derive from their biology - although individual writers sometimes work in their own little quirks.
Long before Harry Potter and his Wizarding World was introduced to us muggles, for example, DC comics had introduce the concept of homo magi in Justice League of America #164 (March 1979) - a race of magic-users who were biologically identical to regular humans, but possessed the genetic capability for magic. This was not substantially different to other "hidden peoples" derived from humans in comics at the time, like Marvel's Eternals, Inhumans, and mutants, just focused on fantasy instead of science fiction.