habit (n.) Look up habit at Dictionary.com
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" (cognates: 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.
habit (v.) Look up habit at Dictionary.com
mid-14c., "to dwell," from Old French habiter "to dwell, inhabit; have dealings with," from Latin habitare "to live, dwell," frequentative of habere "to have, to hold, possess" (see habit (n.)). Meaning "to dress" is from 1580s; "to habituate" from 1610s; "to make a habit of" from 1660s. Related: Habited; habiting.