Actually this topic is a little confusing.
They are illegal in the sense that a person shares all the music, softwares etc. hence providing illegal copies to people all over the world.
But those who say it is legal say that once a person buys something (specially music, not software) then he shares it with his friends,family and other people. So they say that this sharing is also like that. (it is not illegal to lend your CDs that you bought to your friends and other peopl.) So sharing online is another form of that.
But i personally think it is illegal. Sharing your purchases with a few people(friends,family etc.) is a different thing. Sharing it with the whole world is definitely piracy and illegal.
Hope you get the point.