George knows Lennie is going to get shot by the posse anyway, and probably by Curley, so he shoots him himself, in the most painless, peaceful way possible.
The parallel in the novel that sets this up is when Carlson shoots Candy's dog. Candy is broken up about the idea that his friend is gone, but that he let someone else do it when he should have done it himself. Slim reinforces the idea by saying that if he could keep Curley in, maybe they could just catch him and lock him up, but that Lennie being in a cage wasn't any good either.
In the end, it was really the only choice George had.
It is absolutely the right thing for George to shoot Lennie in my opinion. It was the most merciful thing that could be done for Lennie at that point.
If you think about it, Lennie was likely to have a worse fate if he was caught. Curley's father was an important man and Curley was extremely vicious. It seems likely that Curley would have beaten Lennie badly.
It also seems likely to me that Lennie would have ended up being executed anyway. So what Lennie would have faced if George had not killed him was, most likely, a lot of pain, followed by death.
George, at least, gave him a quick death and Lennie died happy, thinking of their dream.
When reading Of Mice and Men, it's easy to identify with what George does and feel relief that he's "put Lennie out of his misery."
It's a bit different, though, when one looks objectively, instead of subjectively, at the situation. When one steps back and gets some figurative distance from the situation, it's not so easy to side with what George does.
Lennie is not an old, sick dog. The parallel between Lennie and Candy's dog actually reflects negatively on George's mercy killing. Lennie is a human being.
One has to ask, at what point should George not kill Lennie? How much more mentally able does Lennie need to be, before it becomes wrong for George to do what he does? And who makes that decision?
A novel is easy. We talk about it and know it's not real. But as far as the ethical dilemma itself, the issue isn't so simple.