It is possible to date scarves back to classical Rome and ancient China by looking at statues from that period, which portraits men wearing scarves. At that time scarves, besides providing warmth, showed social class.
They took time to produce, because everything was handmade. So a scarf showed wealth and high social class, because not everyone could afford a scarf.
A lot have changed and the scarf has descended through the social classes. By the end of the 19th Century it had become one of the most used accessories for men.
Scarves are still popular today, especially if it’s cold outside and you want to keep warm.