According to the philosophical view of Camus, in "The Guest," the Arab did do the right thing by voluntarily walking to the jail even though he was given the choice to avoid doing so by Daru.
The major theme of "The Guest" is that decisions and choices have consequences...
In light of this theme, the Arab must go to the jail to assume the responsibility for the decision/choice he made in committing murder. Camus believes that the Arab would also have chosen to face his fate because he would have realized that death is inevitable for all men, at one point or another. The Arab knows that he has committed murder and that he deserves to be punished.
Daru sees only that he cannot make the decision to take the Arab to jail, so he chooses to let the Arab decide for himself. When he makes his intention clear, the Arab is surprised, and it would seem, unpleasantly so:
The Arab had now turned toward Daru and a sort of panic was visible in his expression.
This is not what the man expected. The Arab expects that he will be taken to jail. Perhaps he has accepted this fact as the men have traveled toward the prison. Daru certainly feels as if the Arab will take his chance to escape, but he is also surprised (as was the Arab at Daru's behavior) by what he sees when he turns back to see how the Arab has progressed:
And in that slight haze Daru with heavy heart made out the Arab walking slowly on the road to prison.
While Daru may not believe that the Arab made the correct choice, Camus' existentialist's view would allow the character to do nothing else.