I'm not a lawyer, but as I understand the situation it's illegal to take certain types of information into account when making hiring decisions (e.g. race, gender, religion I think, sexuality in some states, etc.). It's not illegal to go looking for more information about a candidate, but if in the course of doing so you also find information in those protected categories, it would be illegal to use that information. The act of finding it out is not itself illegal. The morality of doing so on a network not intended for professional purposes -- like Facebook, say -- is questionable. I don't do that.
All that said, a LinkedIn profile specifically is obviously intended for public information, so finding it and reading it seems morally 100% okay in my book, and I do this all the time. I also google applicants to find their Github profiles if they haven't supplied them, and that seems fair to me too.