From dictionary.com:
Word History: The word penthouse goes back to Latin appendere, 'to cause to be suspended.' In Medieval Latin appendere developed the sense 'to belong, depend,' a sense that passed into apendre, the Old French development of appendere. From apent, the past participle of apendre, came the derivative apentiz, 'low building behind or beside a house,' and the Anglo-Norman plural form pentiz. The form without the a- was then borrowed into Middle English, giving us pentis (first recorded about 1300), which was applied to sheds or lean-tos added on to buildings. Because these structures often had sloping roofs, the word was connected with the French word pente, 'slope,' and the second part of the word changed by folk-etymology to house, which could mean simply 'a building for human use.' The use of the term with reference to fancy apartments developed from its application to a structure built on a roof to cover such things as a stairway or an elevator shaft. Penthouse then came to mean an apartment built on a rooftop and finally the top floor of an apartment building.