I don't see a contradiction between Crito and Apology. Keep in mind, Crito is set after Apology. In it, Socrates explains why he ought to accept the punishment imposed upon him. Apology, on the other hand, involves Socrates defending his life and reputation as a teacher against those who would charge him with corrupting the youth and acting impiously. If, in Apology, he acts to defend his life's work, in Crito he accepts the consequences that the state would impose upon him for pursuing it.
That being said, it is important to note that throughout Apology, Socrates frames his intellectual inquiry as driven by a divine inspiration (and thus, his life in philosophy is closely intertwined with piety and his own obligations toward the divine). With this in mind, we observe Socrates claiming to have been "attached to this city by the god" and referring to himself as "the god's gift to you." (These turns of phrase can be found in the paragraph that runs from line 30b to the beginning of 31a. This particular wording was provided by the G. M. A. Grube translation, as found in Plato, Complete Works, ed. by John M. Cooper. Hackett Publishing Company: Indianapolis, 1997.) Furthermore, keep in mind, the Ancient Greeks were not secular: thus sacred obligations would have carried tremendous weight in that society (in fact, remember that impiety was one of the charges levied against Socrates in his trial).
Furthermore, this theme of piety resurfaces in Crito as well. When Crito tells Socrates that he will be executed, Socrates responds: "If it so please the gods, so be it" (trans. Grube, 39d). One gets the sense, then, in this dialogue, that by obeying the laws of the city (and the punishments imposed by those laws), Socrates would continue to uphold the virtues and morality he's spent his life defending and the sacred mission he's spent his life pursuing. (In fact, it might be argued that this is precisely why Plato would argue one ought to obey the law in all cases: to uphold those still higher ideals and obligations in which the law itself is grounded. Remember, Plato tends to be an idealist above all else, and I think it's important to consider how this Platonic idealism might factor into questions such as this one.) In any case, when taking these two dialogues together, I get the sense that Socrates is presented consistently throughout as a moral teacher, acting as a moral exemplar for the benefit and enrichment of Athens, even to the point of death.