Historical evidence suggests, and I am writing from the wiki article of origin of Rum, that during the late 16th and early 17th century, sugarcane plantation slaves in the Caribbean islands discovered a byproduct of sugar-making i.e. Molasses can be converted to an alcoholic beverage. After fine tuning the distillation process they produced the refined Rum. And thus, the origin of Rum can be attributed to the Atlantic region of Caribbean - West Indies.
Now this era (late 16th - early 17th) was the Age of Sail, and all the European powers (British, Dutch, Spanish, Portugeese, French etc etc.) had colonial interests in the New-World (Americas). Thus, it also ushered in the era of piracy and also state sponsored privateering.
Historically, the association of Rum and Pirates was enforced during the Rum-Ration given by the Royal Navy to its Privateers (replacing French Brandy). Many of the privateers later became pirates or buccaneers raiding Spanish flotillas. Since, Rum was in abundance in their area of operation (i.e. Atlantic and Caribbean) it became their favorite beverage.
From a literary point of view, the association of Rum and Pirates was enforced by R.L.Stevenson's Treasure Island. Pirate characters such as, Capt. Billy Bones and Capt. Flint had been depicted as having high affinity to Rum.
All this combined, we see, Jack Sparrow saying sadly-- "why is always the rum gone??" when rum goes missing.
Further, from an actual reason of having abundant Rum onboard ships was to be used as Preservative (thanx to Maj. Stackings for pointing it out), there is an anecdote in the English navy that, after the Battle of Trafalgar, the body of the victorious Admiral Horatio who died during the battle was put inside a Rum Barrel to be transported to England. But when they opened the barrel in England, it was found empty, thus giving rise to the Royal Navy slang - Tapping the Admiral.
EDIT - In reality the body of Lord Nelson was preserved in barrel of Brandy under supervision of surgeon of the navy William Beatty. The barrel was refilled with wine because brandy was absorbed by the dead tissue. This incident might have given rise to the anecdote. But still, rum has always been an integral part of naval activities till the advent of more modern rations and amenities.