To make someone who's trying to seem important less important. Derives from the piss-boner men wake up with in the morning, it's a fake boner. If you took the piss away, there would be no boner. Do you see?
That's the original meaning, however taking the piss now means just giving someone a ribbing and in the most part not meaning to be malicious.
Guy 1: "Hey guys, what do you think to my awesome new haircut?"
Guy 2: "I think you look like a fucking prick, mate...you look like a real slob".
Other guys: "Haha, Guy 2 really took the piss out of guy 1!"
Meaning as it is now:
Guy 1: "Man, I only got a 45 on my last assignment"
Guy 2: "Haha that's fucking shit!"
Guy 1: "Don't be so mean"
Guy 2: "Cheer up man, I was only taking the piss"