There are at least half a dozen theories about this one. What we do know is that the phrase is first recorded in the late eighteenth century in poems by Robert Burns.
One very persistent theory is that the British Army?¢‚Ǩ‚Ñ¢s 99th Regiment of Foot were renowned for their smartness, so much so that the other regiments based with them at Aldershot were constantly trying to emulate them?¢‚Ǩ‚Äùto equal ?¢‚Ǩ?ìthe nines?¢‚Ǩ?. The big problem with this theory is that the story dates from the 1850s, and the phrase is older.
Other attempts at explanation connect it with the nine Muses, or with the mystic number nine, or even perhaps reaching a standard of nine on a scale of one to ten?¢‚Ǩ‚Äùnot perfect, but doing very well.
Walter Skeat (the editor of the Oxford Etymological Dictionary and the first secretary of the English Dialect Society) once proposed that it could originally have been ?¢‚Ǩ?ìdressed to the eyes?¢‚Ǩ?, which in medieval English would have been ?¢‚Ǩ?ìto then eyne?¢‚Ǩ?; the phrase could afterwards have mutated by the same principle that caused ?¢‚Ǩ?ìa norange?¢‚Ǩ? to change to ?¢‚Ǩ?ìan orange?¢‚Ǩ?. But the reverse problem of dating arises here, in that if it were truly medieval in origin one would expect examples to have turned up before Burns?¢‚Ǩ‚Ñ¢ time. As a result, that suggestion is now not accepted by anybody.
Short answer: nobody knows.
K.D. Lightner said:She thought about it for a minute and said, maybe that's where the term "The whole nine yards" come from, too.