Interesting question !
To answer this I actually did a quick quiz around the office, just to see why people think they need a ceiling. And I got all sorts of answers! The most common of these was actually for decoration and concealing the underside of the roof. Another common answer was to prevent heat- some sort of insulation purpose, decoration-nowadays there are all sorts of fancy roofs, and lastly to stop sounds from moving across rooms.
My best bet would be that historically ceilings were developed as a strategy to minimize heat loss from a house- insulation. In hot areas, such as the coast, you are advised to have higher ceilings and roof so that the hot air can rise allowing cooler air in a room.
However, the other uses have developed over time.
In malaria studies, houses with a poor ceiling allow for hiding places for mosquitoes and might contribute to transmission of malaria. So good housing has been studies as one of the approaches to eliminate malaria.