It is common tradition throughout the world's militaries to celebrate when someone is promoted. When a Young Officer is promoted, right before they leave Britannia Royal Naval College in Dartmouth, it is tradition to visit nine pubs throughout Devon and drink a glass of beer or ale about two inches wide and a foot tall. Participants drink three of these per pub, hence "the whole nine yards".
The nine establishments hit are not important- almost all the pubs I visited in Devon while crossdecked at BRNC had the requisite glasses for the tradition. In fact, after about the third pub, you can't remember anything anyhow. This would be a problem, considering the tradition is largely an oral tradition, if the pubs or the order of the pubs were important. In fact, the requirement to drink three glasses per pub is loose too. Serving as the designated driver for the raucous little caravan, I noticed people were losing the ability to count to three, and instead just left for the next pub when they felt ready.
Of historical note, "the whole nine yards" actually predates the World War II explanation above. My hosts explained this tradition actually predates the college (which was founded in 1905), and probably predates the establishment of naval facilities at Dartmouth (in 1863) because the tradition is observed throughout the Royal Navy.