1580s, "Oriental council of state," from Turkish divan, from Arabic diwan, from Persian devan "bundle of written sheets, small book, collection of poems" (as in the "Divan i-Hafiz"), related to debir "writer."
Sense evolved in Arabic through "book of accounts," to "office of accounts," "custom house," "council chamber," then to "long, cushioned seat," such as are found along the walls in Middle Eastern council chambers. The sofa/couch sense was taken into English 1702; the "book of poems" sense (especially a collection by a single author) by 1787.