early 13c., "characteristic attire of a religious or clerical order," from Old French habit, abit (12c.) "clothing, (ecclesiastical) habit; conduct," from Latin habitus "condition, demeanor, appearance, dress," originally past participle of habere "to have, to hold, possess," from PIE root *ghabh- "to seize, take, hold, have, give, receive" (cf. Sanskrit gabhasti- "hand, forearm;" Old Irish gaibim "I take, hold, I have," gabal "act of taking;" Lithuanian gabana "armful," gabenti "to remove;" Gothic gabei "riches;" Old English giefan, Old Norse gefa "to give").
Base sense probably "to hold," which can be either in offering or in taking. Applied in Latin to both inner and outer states of being, and taken over in both sense by English, though meaning of "dress" is now restricted to monks and nuns. Meaning "customary practice" is early 14c. Drug sense is from 1887.