mid-15c., "cord, lace, or ribbon of fine material worn as an ornament or token of victory," from Old French cordon "ribbon, cord," diminutive of corde "cord" (see cord). Military sense of "a line of troops or military posts guarding a place" is by 1758.
The original sense is preserved in cordon bleu (1727) "the highest distinction," literally "blue ribbon," for the sky-blue ribbon worn by the old French order of Knights-grand-cross of the Holy Ghost (the highest order of chivalry under the Bourbons). Extended figuratively to other persons of distinction, especially, jocularly, to a first-rate cook.
Cordon sanitaire (1857) is French, a line of troops or military posts set around an infected district to keep the disease from spreading.