Well, let us remember that Jim and Huck did not deliberately go pass Cairo. They wanted to reach this place, but only realise later that they probably passed it unawares during the very thick fog that came down on them as they were on the river. Even though Huck feels very ambivalent about reaching Cairo because he is not sure if it is wrong to allow Jim to achieve freedom, he is just as surprised as Jim is when they realise their mistake. Note how they establish that they passed Cairo:
When it was daylight, here was the clear Ohio water inshore, sure enough, and outside was the old regular Muddy! So it was all up with Cairo.
Thus we can see that, through an innocent mistake, Jim and Huck went past Cairo during the fog and sailed on down South, where Jim would not be able to gain his freedom and would remain a runaway slave.