Where does the expression “to get in one’s hair” come from and What does it mean?

The expression “to get in one’s hair” means: To have someone or something persistently annoy one; to become greatly irked.

I doubt that this American expression was of Western origin, though its first reported appearance was in the Oregon Statesman in 1851:

“I shall depend on your honor, that you won’t tell on me, cause if you did, I should have Hetty Gawkins in my hair in no time.”

But there had been towns and villages in that territory for almost forty years by that time, so it is of course possible that the expression signified some annoying Oregonian factor that actually did get in one’s hair.

What that annoyance may have been, we are not told.

Nevertheless since body lice were then regarded as a more or less necessary evil, it is certainly within the realms of probability that these were the pests of the early reference, literally irritating the scalp.