Did any of the Headmasters of Hogwarts ever teach after becoming Headmaster?
Were there any constraints which prevented them from teaching?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
I don’t think there’s anything preventing the head from teaching.
I can think of at least two instances in which the acting head teacher was teaching regular classes to students.
Minerva McGonagall, during Dumbledore’s absence in Harry’s second year.
In Chamber of Secrets, Dumbledore is suspended by the Governors, and McGonagall takes over as acting headmistress. There is no indication that she does not continue teaching Transfiguration during this time.
Dolores Umbridge, during Dumbledore’s absence in Harry’s fifth year.
In Order of the Phoenix, she managers to temporarily remove Dumbledore and declare herself Headmistress. (Note, however, that the Head’s office refuses to acknowledge her, and will not allow her to enter.) She continues to teach Harry and co. in DADA up to their O.W.L. teams.
It seems likely that most head teachers would choose to give up teaching when they took up the position (as the workload of running the school and teaching multiple classes is probably too much for one individual), but there doesn’t seem to be a rule or enchantment preventing them from doing so.