It originally served to stabilize and hold the hat on the head and to prevent the hat material separating.
A hat band fulfils a similar function.
Hatcords sometimes come in imaginative fashion-oriented designs.
In the Middle Ages, the hat cord was also used as a unit of measurement to control the thickness of water pipes.
According to Duden, it is questionable that the German saying: Das geht (mir) über die Hutschnur ("That exceeds the hatcord [as far as I'm concerned]") meant das übersteigt das Maß des Erlaubten ("that exceed the permitted amount").