The original negative meaning for this phrase is punishment or criticism or other bad treatment, and goes back to the 17th century.
The positive meaning of ‘kick in the pants,’ is excitement or pleasure. One meaning of ‘kick’ is the kind you get from strong liquor, a jolt or sharp stimulation, and often, therefore, a thrill. Think of the song, “I get a kick out of you.” This meaning appears from the 19th century on.
Other versions of the phrase are: a kick in the teeth, a slap in the face, and, of course, a kick in the ass, or the behind.
If you describe the way someone treats you as a kick in the teeth, you mean that that person treats you badly and unfairly, especially at a time when you need their support. In other words, the treatment is “adding insult to injury.” It’s bad news and may be humiliating as well.
You might also use this phrase to mean that although the situation is less than ideal, you accept it because worse things could be imagined. For example, “My pay raise is nowhere near as much as I expected, but it’s better than a slap in the face with a wet fish.” Or one might say, “better than a poke in the eye with a sharp stick,” or, of course, “better than a kick in the pants.”
It seems to me that the use of both positive and negative versions of ‘a kick in the pants’ are advocating strong action. For example, if a coach knows that his team needs a kick in the pants, he’s saying they need inspiration and encouragement. On the negative side, somebody might say the neighbor’s kid is an undisciplined, rebellious brat and that he needs a good, swift kick in the pants to help him to straighten out.
In old slapstick movies, somebody was always getting a (fake) kick in the pants.