It’s a shortened version of the expression “Take the hair of the dog that bit you” and is now used to refer to the practice of having a morning drink as a hangover cure. The expression originated from a superstition regarding rabies: it was believed that if one was bitten by a dog, placing some of that dog’s hair on the wound would prevent rabies. The alcohol-related use of the term dates back at least to Shakespeare.