Think of Sergeant Elias as the like angel on Taylor's soldier (which makes Barnes the devil). Both Elias and Barnes battle for Taylor's "soul," as Taylor says at the end of the film. In many ways, Elias is the voice of reason and morality in the hell of Vietnam. He's the one guy who, more than the others, maintains some integrity. This is ultimately why, dramatically speaking, he has to go. There's no place for "crusaders," as Barnes calls him, in the morally bankrupt universe of the front lines.
One of the Good Guys—Maybe the Best
So just how is Elias a "crusader," and a bastion of morality? For one thing, he doesn't stand for unethical behavior. When Barnes is on the verge of executing a little girl, and just after he has executed an innocent woman, Elias runs in, hits him with the butt of his rifle, and starts kicking his butt. The fight is quickly broken up, and Elias, his face a mixture of sweat, tears, and dirt, screams at Lieutenant Wolfe: "Lieutenant why the f*** didn't you do something?"
Elias is a crusader because, well, he insists on doing what's right even amidst the lawlessness of Vietnam—he, like Taylor, used to believe in the war effort, but that belief has long since gone. Despite the fact that he has no more illusions, Elias still insists on holding himself and his men to a high moral standard.
At one point, Barnes even mockingly refers to him as "water walker," a remark no doubt meant to take a shot at Elias' own sense of holiness. In a lot of ways, though, Barnes' remark is perfectly apt for Elias is sort of a prophet, a guy who knows the ugly truth and predicts the eventual outcome of the war (a loss for the United States). In a conversation with Taylor one night, he says to him: "What happened today [the village fiasco] is just the beginning. We're gonna lose this war…We've been kicking other people's asses for so long I figure it's time we got ours kicked."