According to the Dictionary of American Politics there was a time, on Southern plantations, back before the Civil War, when “the opening of a barrel of pork caused a rush to be made by the slaves.”
Maybe so, though we doubt it. At any rate, even if so it had nothing to do with the present-day political implications of our phrase.
Pork is fat, and “fat,” for hundreds of years, has meant plenty, abundance, “Ye shall eat the fat of the land.”
Thus, anything especially lucrative or richly rewarding became “fat,” and, a hundred years ago, especially in the halls of Congress, by simple transference became “pork.”
Primarily, however, political “pork” in the luxuriant aftermath of the Civil War was any favor, distinction, or governmental money allotted to a district on no other basis than patronage.
Later, roughly fifty years ago, when Congressmen began to seek larger appropriations to impress their constituents, as for river or harbor improvements, public buildings, or the like, such an appropriation became a “pork barrel.”