If you have an iPhone (or iPod), Apple has issued a warning that you might want to pay close attention to.
They have written statement on their website saying “It’s possible to receive a small and quick electrical (static) shock from your earbuds while listening to iPod or iPhone.” Apple goes on to say “When using headphones in areas where the air is very dry, it is easy to build up static electricity and possible for your ear to receive a small electrostatic discharge from the headphones. Receiving a static shock from a pair of earbuds does not necessarily indicate an issue with the iPod, iPhone, or earbuds. This condition is very similar to dragging your feet across a carpet and receiving a static shock by touching a door knob. However, instead of the static charge building up on your body, the charge builds up on the device that the earbuds are connected to. Likewise, instead of the static buildup discharging through your finger when you touch a door knob, it discharges through the earbuds.”
In addition, Apple does make sure to note that this is not just their product and can potentially happen with any earbud brand. They do provide a solution to fix the electric shock you may feel:
Avoid using the headphones in extremely dry environments or touch a grounded unpainted metal object before inserting the headphones; try raising the moisture level in the air of the local environment by using a portable humidifier or adjusting the humidity control on your air conditioner; use an anti-static spray to reduce static; try anti-static hand lotion if you have dry skin and finally… Try wearing different clothes.
More here at Apple