Steinbeck's Of Mice and Men has a lot to say about loneliness. In fact, even the town near where the men work, Soledad, means "solitude." Even though they work in the town of Solitude, they are not alone.
I think one thing Steinbeck is trying to get his readers to understand is that people need each other, even if the relationships may not fit the conventional paradigm that society might expect. George and Lennie are the obvious example here. One man is short and "street-wise", while the other man is huge and simple-minded. All the same, the two men need each other, compliment one another (one provides "the brains", the other provides "the brawn"), and share a common dream.
Another thing Steinbeck wants us to know about loneliness is that sometimes people can be together and yet still be alone. Curley and his wife are the main example here. They are husband and wife, yet their relationship is clearly damaged, even though they have only been married a very short time. Curley's wife has already "got the eye" after only a few weeks of marriage. Curley is already jealous of his wife and doesn't even seem to know where she is half the time.
Carlson said casually, “Curley been in yet?”
“No,” said Whit. “What’s eatin’ on Curley?”
Carlson squinted down the barrel of his gun. “Lookin’ for his old lady. I seen him going round and round outside.”
Whit said sarcastically, “He spends half his time lookin’ for her, and the rest of the time she’s lookin’ for him.”
Curley burst into the room excitedly. “Any you guys seen my wife?” he demanded.
Thus, in Steinbeck's novel, we are presented with a number of characters who experience lonliness in a variety of ways. In the end, though, I think Steinbeck realizes that people need each other, despite their feelings that sometimes they want to be alone:
George looked quickly and searchingly at him. “I been mean, ain’t I?”
“If you don’ want me I can go off in the hills an’ find a cave. I can go away any time.”
“No—look! I was jus’ foolin’, Lennie. ‘Cause I want you to stay with me."