>>2842596
It's a purely military thing. Whenever shouldering the rifle, the wide brim hat could get hit by said rifle so the soldiers started pinning it on the side to prevent that which would become standard practice.