c. 1200, "body of persons living under a religious discipline," from Old French ordre "position, estate; rule, regulation; religious order" (11c.), from earlier ordene, from Latin ordinem (nominative ordo) "row, line, rank; series, pattern, arrangement, routine," originally "a row of threads in a loom," from Proto-Italic *ordn- "row, order" (source also of ordiri "to begin to weave;" compare primordial), which is of uncertain origin. Watkins suggests it is a variant of PIE root *ar- "to fit together," and De Vaan finds this "semantically attractive."
The original English word reflects a medieval notion: "a system of parts subject to certain uniform, established ranks or proportions," and was used of everything from architecture to angels. Old English expressed many of the same ideas with endebyrdnes. From the notion of "formal disposition or array, methodical or harmonious arrangement" comes the meaning "fit or consistent collocation of parts" (late 14c.).
Meaning "a rank in the (secular) community" is first recorded c. 1300. Sense of "a regular sequence or succession" is from lare 14c. The meaning "command, directive" is first recorded 1540s, from the notion of "that which keep things in order." Military and honorary orders grew out of the fraternities of Crusader knights.
The business and commerce sense of "a written direction to pay money or deliver property" is attested by 1837; as "a request for food or drink in a restaurant" from 1836. In natural history, as a classification of living things next below class and next above family, it is recorded from 1760. Meaning "condition of a community which is under the rule of law" is from late 15c.
In order "in proper sequence or arrangement" is from c. 1400; out of order "not in proper sequence or orderly arrangement" is from 1540s; since 20c. principally mechanical, but not originally so ("and so home, and there find my wife mightily out of order, and reproaching of Mrs. Pierce and Knipp as wenches, and I know not what," - Pepys, diary, Aug. 6, 1666).
Phrase in order to "for the purpose of" (1650s) preserves etymological notion of "sequence." In short order "without delay" is from 1834, American English; order of battle "arrangement and disposition of an army or fleet for the purposes of engagement" is from 1769. The scientific/mathematical order of magnitude is attested from 1723.