This, like many style rules, begins with business dress. Many style rules (particularly the ones that feel especially out-of-date) were birthed to help guide the young businessman away from choices that would embarrass him or his coworkers during the big meeting. The structure of this rule dictates that if you wear black pants, you need to rock black socks. If you're wearing navy or neutral blue pants, the socks have to be the same. It's more for suiting than anything else, but some purists would believe that no matter what you're wearing, the socks at the very least need to be in the same color range as the lower half of your outfit.
This rule has seen plenty of opposition as dress codes have relaxed over the years, and many people who would have once enforced this rule would instead suggest matching your socks to any part of your outfit. No matter what you believe, the idea of being matchy-matchy with your socks seems less than appealing and more tacky than stylish (depending on what colors you're wearing). With labels like Happy Socks and Stance creating wild printed options for your feet, many guys use socks not as an afterthought, but as a completely unique and diverse part of their complete kit.