To make them look old, of course. Sounds silly, but it is true.
If a cowboy wore a new hat, he might be taken for a “tenderfoot,” a newcomer. Even if an old-time Westerner wore a new hat, he was teased about it.
The men of the Old West wanted their hats to look old and beat up. So they had a special way of making new hats look old. They dug a hole in the ground and put their hats in it.
They filled the hole with water and then covered it with dust and sand. After a few days they dug up the hat and then left it out to dry in the sun. Several days later, they would go back for the now completely dry hat.
They had themselves a hat that looked like it had been worn for years and years. Some cowboys even “smoked” their hats. They held them in the smoke of a fire until they were thoroughly smoked up.
This sort of treatment was supposed to make them more waterproof.