From Saint Thomas' Summa Theologiae, I-II.49.1c:
This word "habitus" [habit] is derived from "habere" [to have]. Now habit is taken from this word in two ways; in one way, inasmuch as man, or any other thing, is said to "have" something; in another way, inasmuch as a particular thing has a relation [se habet] either in regard to itself, or in regard to something else.
Concerning the first, we must observe that "to have," as said in regard to anything that is "had," is common to the various predicaments. And so the Philosopher puts "to have" among the "post-predicaments," so called because they result from the various predicaments; as, for instance, opposition, priority, posterity, and such like. Now among things which are had, there seems to be this distinction, that there are some in which there is no medium between the "haver" and that which is had: as, for instance, there is no medium between the subject and quality or quantity. Then there are some in which there is a medium, but only a relation: as, for instance, a man is said to have a companion or a friend. And, further, there are some in which there is a medium, not indeed an action or passion, but something after the manner of action or passion: thus, for instance, something adorns or covers, and something else is adorned or covered: wherefore the Philosopher says (Metaph. v, text. 25) that "a habit is said to be, as it were, an action or a passion of the haver and that which is had"; as is the case in those things which we have about ourselves. And therefore these constitute a special genus of things, which are comprised under the predicament of "habit": of which the Philosopher says (Metaph. v, text. 25) that "there is a habit between clothing and the man who is clothed."
But if "to have" be taken according as a thing has a relation in regard to itself or to something else; in that case habit is a quality; since this mode of having is in respect of some quality: and of this the Philosopher says (Metaph. v, text. 25) that "habit is a disposition whereby that which is disposed is disposed well or ill, and this, either in regard to itself or in regard to another: thus health is a habit." And in this sense we speak of habit now. Wherefore we must say that habit is a quality.