The river was Huck's route to escape from his drunken, abusive father and from the demands of civilization at the hands of the Widow Douglas. Huck took great pains to create the appearance that robbers had ransacked the cabin, killed Huck and dragged his body away to the river.
I says to myself, they'll follow the track of that sackful of rocks tot he shore and then drag the river for me....They won't ever hunt the river for anything but my dead carcass. They'll soon get tired of that, and won't bother no more about me.
For Jim, the river was a way to avoid being sold south. He overheard Miss Watson telling the Widow Douglas that she was planning to sell Jim to the "nigger trader" because "she could git eight hund'd dollars for me, en it 'us sich a big stack o' money she couldn' resis." Jim didn't plan ahead of time to take to the river, but he came to realize
ef I kep' on tryin' to git away afoot, de dogs 'ud track me; ef I stole a skift to cross over, dey'd miss dat skift, you see, en dey'd know 'bout whah I'd lan' on de yuther side en whah to pick up my track. So I says, a raff is what I's arter; it doan' make no track.
In different ways and for different reasons, the river represented the opportunity to start a new life of freedom for both Huck and Jim.