Romans used to use the ammonia in urine to clean sweat and salt off of clothes, and then a second round of sulphur would whiten the urine color off of the clothes. You'd have to have your clothes airing out for a year to get the stench out.
"Taking a piss" is literally urinating. Piss is a synonym for urine. "Taking the piss" in this context means mocking somebody/something.
You can also "take the piss" if you're lying, exaggerating or any number of other social mistakes. If someone said that they had 5 years experience in PHP on their CV and you later found out they didn't, you could say they were taking the piss.
Obviously, it's quite an informal phrase. It's also one that just sounds wrong out of context, the correct context being quite hard to define. Like all slang you have to live amongst people using it before you pick up correct usage.
> Urine from London was shipped up the coast to Yorkshire, where there was a big dyeing industry, and this is the origin of the phrase "taking the piss'.
> Captains were unwilling to admit that they were carrying a cargo of urine and would say that the barrels contained wine.
> "No, you're taking the piss" was the usual rejoinder.
You can see that accusing someone of "taking the piss" is to call them out on something embarrassing and also to accuse them of lying (about it).