The reason for this is two-fold, really: on a crowded train (as they almost certainly are), you'd rather be rubbed up next to someone you know personally, as opposed to someone who is sweaty and weird and might try to grab your inner thigh (this hasn't happened to me yet, but I'm fairly certain it's only a matter of time). It also eases the pain of making someone move their bag/purse/box of shrunken human heads easier from that empty middle seat because, hey, I know the person sitting beside your bag/purse/box of shrunken human heads.
And when you're desperate for a train buddy, just about anyone will do.
It doesn't have to be someone you've gone out to dinner with and shared one of those divided "Best Friends" necklaces where you have "Best" and he or she has "Friends" with. In fact, it can just be someone you know informally. But the question that should loom largest is: do you think that you can carry on a conversation with this person for more than an hour? I think, trapped in an enclosed metal tube with a bunch of drunk yuppies, I don't think I'd be able to talk to my own father for an hour, but in these situations you lower your standards and get on with it.
Some other things to take into consideration: you won't be able to listen to your music (yes, even if you just downloaded that three-disc Joanna Newsom thing) and you won't be able to read. Sitting down next to someone locks you in to a conversation, whether you like it or not. You two are inseparable for the entire trip and have to fill that up with catching up, idle chitchat, asking about how so-and-so is doing and talk about who you think will win the Best Picture Oscar in the expanded, ten-movie field. Results may vary.
But I've found that this offers more positives than negatives, even if there are lulls where you either don't talk or have to sit in shocked silence as you hear about their recent trip to India and the strangely erotic multi-person rubdown/massage they got while they were there. The biggest positive I can think of is that it keeps you awake. There are few things worse than nodding off on the way home and waking up in a town not your own. Talking to someone on the ride home, even if you barely know them, cuts that possibility out of the equation and with it gets you out of the frantic disorientation and scramble to get someone to pick you up from whatever dusty, late night station at which you end up.
On an even deeper level it does remind you that the people you ride the train with are actual people and not just huffing, grunting animals that take personal offense when you tell them you'd like them to move their briefcase so you can sit down. And more than that, these people suffer through the very same indignities you do and are juts as exhausted, worn out, and embittered by their commute. It's then that you realize a little company goes a long way.