At the end of the story George shoots an unsuspecting Lennie in order to prevent him from falling into the hands of the lynch mob or being turned over to the authorities. Lennie killed Curley's wife, most unintentionally, but no-one except George and Slim (and maybe Candy) understand that it was purely an accident.
It is a terrible thing for George to have to kill Lennie, as Lennie was his best friend and long-time companion, but Slim is the only one who understands. Slim knows that George kills Lennie as an act of mercy, to prevent him from a worse death at the hands of the other men or from incarceration. Slim realizes that this is the best way out of a cruel situation, and in fact advises George to do it. That is why he says to George afterwards: 'You hadda, George. I swear you hadda', and goes with him to have a drink. He is trying to comfort him as best he can.
None of the other men understand the depth of George and Lennie's friendship, but Slim understands everything. He is presented throughout as being a man of superior wisdom and compassion, indeed he is described as being 'Godlike'. The other men at the ranch look up to him, and George is no exception.