That any kind of friendship should develop between the competitors of the eponymous long walk seems quite astonishing. After all, each and every one of these young men is involved in what is quite literally a life-or-death struggle; if they don't win the competition, they will die. One would imagine, then, that all thoughts of friendship would go out the window in the headlong dash for survival that the long walk entails.
And yet a sense of camaraderie develops among the young men. There seems to be a general realization among them that they're all in the same boat and must somehow try to help each other as best they can. One of their number, Scramm, has a pregnant wife, and the other guys in the race agree that they'll help out his window if they're fortunate enough to win.
Friendship is particularly helpful to the story's protagonist Garraty. During the race, he's befriended by a fellow competitor called McVries. McVries helps save Garraty from certain death when it seems that Garraty can't carry on any longer. When he sees that Garraty is struggling, McVries yanks him to his feet. Not long after, when Garraty complains that he can't do it and that his wind has gone, McVries slaps him twice across the cheeks.
In helping out his friend, McVries has saved his life. Had it not been for his intervention at such a crucial juncture in the race, then Garraty would have been handed his ticket, as the saying goes. In assisting his friend, McVries was also placing his own life in jeopardy, confirming our impression of him that, deep down, he actually wants to die.