"a hit with an explosive sound," c.1400, of imitative origin. Meaning "flavored carbonated beverage" is from 1812.
Sense of "ice cream on a stick" is from 1923 (see popsicle). Meaning "the (brief) time of a 'pop'" is from 1530s. Pop goes the weasel, a country dance, was popular 1850s in school yards, with organ grinders, at court balls, etc.