The expression originated in the 17th Century, or perhaps earlier, based on the thought that a human hair was so thin that it would be a waste of time to try to split it. Some developed the art of winning arguments based on small differences or trivial points to divert from the main argument, which is how the expression is used today.