The reason was, as shown in Itachi's flashback genjutsu on Sasuke, that he would assist Obito in his revenge against the Uchiha, but the terms were twofold. The first was that Obito does not cause harm to the rest of the village as a whole, and the second was that he does not touch Uchiha Sasuke.