Knitting socks goes back at least to the 11th century. The oldest surviving knitted item is a pair of colourwork socks from Egypt, and while no earlier items have yet been discovered, the complexity of both the sock construction and the colourwork suggests that the craft was developed much earlier (because, after all, if you were inventing a new craft that had never been done before, elaborate geometric stranded colourwork on a three-dimensional shaped item would probably not be a first project!).
While most socks were knit from wool, finely knit socks out of luxury textiles like silk were prized by the aristocracy and royalty of Europe. Elizabeth I was a great patron of the sock and stocking industry, and refused a patent to the inventor of the first stocking frame knitter, as she believed the result too coarse and felt that it was an economic threat to the many hand knitters in England. It is said that the clergyman-inventor developed the machine because a woman he wanted to court had more interest in her knitting than in him, and he hoped his invention would instead focus her attention on him.
Sock knitting sustained many a rural family, as it was a cottage industry that could provide extra income when times were rough. The predictable, easy math involved in knitting socks meant that they could be made while doing any number of other tasks, and it was an industry that the entire family could participate in. I remember my grandmother telling me about how working on the legs of socks was a job that tended to be passed on to the youngest knitters in her family, and how it was a mark of skill to be allowed to do the ribbing or the gusset decreases. The toe and heels of all the socks were reserved for the most skilled siblings, and this method of production meant that socks for the very large family were produced efficiently.
Numerous charities were set up in England during the eighteenth and nineteenth centuries, aimed at teaching poor women to knit. While by this time, many socks were produced by frame knitting, hand knitted socks were still much preferred for their more comfortable fit and also for the finer yarn that was used to produce them, and as such, there was a solid market for well-produced hand-knitted socks. It was believed that teaching the poor to knit would keep them from a life of crime, as reflected by great deal of moralizing in many of the knitting teaching manuals that survive from this period.
Even military history is touched by the knitting of socks: sailors and soldiers alike throughout history were consummate sock knitters, either for the direct benefit of their own benefit or for trade. One of the most useful methods of grafting, the Kitchener stitch, was developed as a way to prevent a seam that would wear and create blisters for soldiers on long marches. During the first and second world wars, there were numerous drives for knitted goods -- socks, in particular, were always in high demand.
So remember, whether you are knitting your first or fiftieth pair of socks, you are taking part in a long tradition that has given economic support, enjoyment, and of course, cozy toes!