Magnet links are perfectly legal. However be aware of the content you’re downloading - for example clicking on torrent magnet links to download and share copyrighted music or movies could be illegal.