It's not unprofessional. LinkedIn is a professional networking site. "Networking" is an incredibly broad term, people can be in your network for a number of reasons. The hiring process for a specific role at a specific employer is a totally separate, and very narrow, thing. The outcome of that process doesn't inherently alter whether or not you'd want someone in your network (which is what I'd base "is it professional to invite them" on).
To put it another way: You'll get people in your LinkedIn contacts list from a wide variety of sources. I have people in my contacts who I worked with years ago, people I've never worked with, people whom I fired, people whom I interviewed and did not hire, people who interviewed me and picked someone else, people I met at conferences, people I've never met, and so on.
Regardless of whether or not your employer hires this candidate, you have a legitimate business relationship with them - which is all it takes to consider adding someone to your network.
If you do decide to add them, it's probably best to do so after the hiring process is complete, so your invitation isn't perceived as part of the process. Also, unless authorized, you should not discuss the hiring process with that person.