Well, initially they were just a style of hats to simply cover your head. It's only until the turn of the 20th century do people see them as part of more formal wear. When they were first developed by the late 18th century, they were simply a part of evolving clothing, following the cocked hat (or tricorne as people now call them). People of all classes wore top hats in the early 19th century. Wealthier could afford better quality like fur felt hats, whereas more common folk would wear more wool felt.