A hat is an important piece of garment of every cowboy - this is also true in Red Dead Redemption 2. Sadly, your character can easily lose his hat due to, i.e. getting hit in a fist-fight or hitting an obstacle. Check this page to learn how to retrieve your hat (or other headwear).
Losing a hat in RDR 2 isn't that important but it can be irritating when you lose your favorite hat bought at a store.
- Look around the place where you have lost your hat. There is a good chance that it hadn't disappeared yet which means that you will be able to pick it up.
- Go back to your gang hideout if you can't find the hat. Head to Arthur's tent and interact with the chest containing your pieces of clothes (see the picture 1). Go to the Hats tab and select the headwear from the list. Hats are assigned to you permanently when you receive them or purchase at a store.
Additional note - This chest also has all other pieces of clothes owned by your character. Go back to it when you have to, i.e. change winter clothes to those fit for summer.
The process of retrieving your hat can be "automatized" - you won't have to go back to the clothes chest every time you lose a hat. You can do that by assigning a hat to your horse's inventory. Highlight the hat you want to assign, and press the button to add it to your horse's inventory (Square is the default button on PlayStation 4).
While on horse, you can open the wheel menu (L1 in default) and then go to the last tab - Horse. You can now select the previously assigned hat (the picture above shows an example).