I actually don't find the fact that many Starfleet officers know each other that baffling. It's a somewhat tight-knit organisation and I assume people stay informed on what goes on inside the fleet, exchanging gossip and things like that.
I recently was at a meeting of a local Pirate Party group and the people there seemed to know any other active party member. I told one of them that a friend of a friend is also a member and my vague description was enough for him to identify her and he had a good idea of her character and her political convictions. It was kind of impressive and also somewhat baffling but the answer is pretty simple. They follow each other on Twitter and other forms of communications (blogs, the party forum, Mumble). It stands to reason that there are similar tools in use within Starfleet and that you can get to know someone without meeting them in person.