Hats are brought from the Hat Shop (also called Dressing Room) by spending Coins, Rubies or Diamonds. Only Zebras in the Jungle, Continent and World can wear hats. This means that Zebras on Mars, in the Pantheon or Ultimate Beings in the Universe cannot wear any hats. The hats do not add any effects to the zebras - they are purely for aesthetic.
There are three Achievements related to buying and wearing hats.