It comes from the idea that somebody is like an itch - very hard to ignore. So it basically refers to someone that you can't stop thinking about, and is usually used in a romantic context. It can be used in a negative way too - if you keep annoying someone, you end up getting under their skin as well.