Is it farther or further?
mid-15c. "of or pertaining to the law," from Middle French légal or directly from Latin legalis "legal, pertaining to the law," from lex (genitive legis) "law," possibly related to legere "to gather," on notion of "a collection of rules" (see lecture (n.)).
Sense of "permitted by law" is from 1640s. Related: Legally. The Old French form was leial, loial (see leal, loyal). Legal tender is from 1740.