Hats have been around for centuries. For instance, the sugar loaf was a hat worn by Puritans back in Medieval Times.
Napoleon popularized the bicorne, or two-cornered chapeau, in the early 1800's. Military officers had worn hats to show their rank.
George Washington, during the American Revolution, wore a tricorne, or three cornered hat.
Abraham Lincoln popularized the tophat, often worn by statesmen, in the mid-1800's.
The bowler hat was worn by the middle class and even by cowboys in the Wild West. Likely the most famous person to wear a bowler was Charlie Chaplin.
In 1865 Stetson first produced the cowboy hat, a convenient head covering for horseback riders since it protected them from the sun and the rain (it was waterproof).
The sombrero was the Mexican version of the cowboy hat, with even wider brims.
The boater, a straw hat with a ribbon around it, was worn by barbershop quartet members in the 19th century.
The panama hat, or soft straw hat, was worn in warm climates. Theodore Roosevelt, who held the office of the President when the Panama Canal was built, sports one below.
The porkpie, originally worn by American Civil War soldiers in the 1860's, enjoyed a resurgence in the 1930's among jazz musicians.
The beret became popular in the mid 20th century in the Basque region of Europe, especially among Beatniks, artisans and revolutionaries (like Che Guevera).
The fedora became popular in the 1930's, sported by gangsters like Al Capone.
So what happened to hats? I read a blog written by a guy whose father used to own a hat shop. He claimed that in the United States, the dividing line was 1961 when President John F. Kennedy was inaugurated, and he didn't wear a hat. Every president previous to JFK did sport a hat. However, the blogger's father claimed that the dividing line was the previous president, Dwight D. Eisenhower who built roads all over America. People moved to the suburbs and started driving to work rather than commuting by train, bus or streetcar. Whereas public transportation offered riders about 3 feet of headroom, cars offered them about six inches. The hat had to go! Bloggers seem to agree that hats largely disappeared from American culture in the 1960's.