Social Media is a new media that is still unnatural and leads to ambiguity. There is a greater disparity, in the perception of the etiquette and usage of various social media platforms, than physical communities. It is best, in such cases, to first be sure of the etiquette that a given person adheres to regarding a given social media. In your case, a simple question you could have asked before connecting with the professor is this: "Is the professor connected to other students on LinkedId?". Having said this, you certainly did not do anything unprofessional.
A Probable Cause for Miscommunication
A probable cause of such confusions comes from one basic dynamic of social networking: "People across different age groups and different communities have a different perception of social media etiquette."
This is very common and leads to many cases of miscommunication in social media (more than in physical communities). For example, we have witnessed a difference in the perception and usage of Facebook across different age groups, and how teens may feel embarrassed about what their parents may be posting on social media and how they are using it. (You may look at Prof. Cristian's work to look at more concrete examples of social media miscommunication).
With this hypothesis at our disposal, it is now understandable that some people may consider LinkedIn as a platform to network with professionals who are colleagues or are equal in position. As mentioned in one of the answers, students would not be considered equal by many people, and they may consider them students in the sense of a high-school student. Having said that, it is certainly not "extremely unprofessional" and this was more of an opinion of the said professor.
A General Heuristic
In such cases, a general heuristic that I use is that I first observe if a given professor connects with students on a given social media platform or not, and how friendly and active he is. On one extreme, I have professors who are highly active on Facebook and connect with students there. On the extreme, there are professors who do not even respond to emails and I have to meet them during their strict office hours.
I consider it presumptuous (it's my personal opinion) to assume that a given professor looks at a media the same way as I do.