This article is from the alt.usage.english FAQ, by Mark Israel firstname.lastname@example.org with numerous contributions by others.
This expression, meaning "very fashionably and elaborately
dressed", is recorded from the 18th century. "The nine" or "the
nines" were used to signify "superlative" in numerous other
contexts. Theories include: 9, being the highest single-digit
number, symbolized the best; a metanalysis of Old English "to
then eyne" "to the eyes"; and a reference to the 9 muses.