Online indexes of digital content of media and software aren’t illegal. Just look at legittorrents.info. What’s different between this site and The Pirate Bay is that distribution of copyrighted material without the right to do so is indeed illegal.
The Pirate Bay, in broad terms, is a website that is a collection of magnet links that allow circulation of the files between users without a host. It might seem surprising, but The Pirate Bay doesn’t breach any copyright infringement laws. However, it could be argued that they create a platform where such exchanges between users are effortless, thus helping piracy.