My guess is that it comes from the concept of rubbing salt in the wound. It hurts, but it used to be a common natural medication for aiding in the healing of open wounds. It still is used for sore throats by many (salted water).
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.