I was thinking about this and was wondering if my behavior is unethical - the information was public, and I didn't think much of doing so at the time.
I told my colleague about it and he seemed surprised. Should I apologize?
I suggest you ask him, e.g.
"I noticed you seemed surprised when I said I'd looked you up on LinkedIn. I've been feeling bad about it in case it upset you in any way. *Are you okay about it?"
I have edited the last part of my answer in response to valid comments. I feel that a final question is needed in order to encourage the other person to have their say. I'm open to other suggestions.
As Ister suggests, "I hope you weren't offended" is another good possibility to finish with.
Other answers are fairly blunt in the “No…” category, but I believe there is subtlety here:
If you feel you need to apologize, then you should apologize…
But don’t feel bad about it.
Yes, if a LinkedIn profile is made public then people can view that profile and then (based on their level of access in LinkedIn) they can see they viewed your profile. All fair.
And yes, you can lock down your LinkedIn profile so you can only allow people you are connected to to view that profile. That is fair.
But at the end of the day there is human etiquette. And if you feel that you might have offended someone by simply looking at their profile, you should apologize.
You should not recommend that they lock down their profile because why should they? Because ultimately if the profile is public, they might have a good reason to do so and not really want to alter their online presence for the needs of one random person they just met.
In general think about public online profiles like mail: You know, I can see my neighbors ordered items from Amazon. And many packages have tracking numbers right on them. There is technically nothing stopping me from making note of that tracking number and then—the next time I saw my neighbor—say something like, “Boy! That Amazon package you just got took a long time to get to you!” I mean, that’s prying and kinda crazy, right?
Ditto with online public profiles.
In the case of your co-worker, if they were stunned by what you did just say something like:
“Well, sorry about that. But since I was starting this job and just wanted to get to know my co-workers. My apologizes if that was an indirect way of going about it.”
The reality is that technical boundaries—such as blocking access to a profile—and human etiquette are two different things.