Fog is an interesting weather feature. In simplest terms, it is a cloud at ground level. That shouldn't be scary or ominous. Most people remember times when they looked up into the sky and imagined various shapes being displayed by a cloud, yet when that cloud is at ground level and obscures visibility to practically zero, fog can be scary. This is especially true if a person is in a new location. You can't see through it to give yourself a decent set of bearings, and the fog has the tendency to deaden/dampen sound enough to where feelings of confusion and claustrophobia are not uncommon. The world feels cramped, and everything looks and sounds different.
Readers see both Huck and Jim panic when the fog descends on them, and they get separated. I think the fog can be symbolically related to Huck's confusion about what to do with and about Jim in general. It's not uncommon for a person to express their lack of strong, coherent thought by saying that their head was "in a fog." Huck's head is frequently in a mental fog with doing what is right. Turning Jim in is the right thing to do by societal rules. Keeping Jim safe is the right thing to do by Huck's own moral compass. The literal fog caused confusion that mirrors the confusion and fear that Huck is forced to battle throughout the story regarding Jim's fate.
Fog plays an important role in chapter 15, in which Huck and Jim are looking for the place where the Ohio River joins the Mississippi. The fog is symbolic of the moral ambiguity of Huck's plight and of the "unnaturalness" of his situation with Jim. The fog is a kind of opponent; it makes what had been plainly visible obscure; it forces Huck to call out to Jim to find him and to listen closely to hear Jim's answering calls. In the "unnatural" whiteness of the fog, Jim's status as a slave is less important than his function as a beacon of sorts. In other words, the fog causes Huck to seek out Jim not to turn him in, but to find a place of safety. The river in a fog is a frightening place: as Huck says, "If you think it ain't dismal and lonesome out in a fog that way by yourself in the night, you try it once—you'll see."
There are two significant scenes where the fog confuses and misleads Huck and Jim while they are traveling down the river. The first time that the fog surrounds Huck and Jim, they are separated from each other. Huck is in a canoe and loses his sense of direction in the fog. He is unable to paddle back to Jim but eventually reunites with him when the sky clears up. Huck and Jim are again affected by the fog and unintentionally end up sailing past Cairo. In my opinion, I believe that the fog symbolizes Huck's confusion. Huck is struggling to deal with the dilemma of turning Jim into the authorities or helping him gain his freedom. Huck understands and is influenced by society's expectations, but he also has a conscience. Huck's conscience tells him that Jim is a genuine human who is not a piece of property. Huck believes that Jim should be free, but also realizes that he is committing a crime by helping Jim escape. Similar to Huck's decision, the fog is confusing and difficult to maneuver through.
If we think of the literal meaning of fog, it is something that prevents us from seeing our way. It is difficult to move in fog, difficult to reach our destination.
The symbolic meaning of fog in The Adventures of Huckleberry Finn appears to be similar. It is symbolic of obstacles, things that get in our way and prevent us from achieving our goals.
It is a foggy night that causes Jim and Huck to miss Cairo and freedom. I think the fog symbolizes the confusion Huck feels about helping Jim escape. Huck has been raised in a racist society, and it was against the law to help a slave escape. Huck wrestles with the moral dilemma of helping Jim, but he follows his heart in the end because he sees Jim as a man and not as a slave.
The fog might also symbolize the journey of Huck and Jim as well. Both of them are seeking freedom, but their road to freedom is much like trying to find their way through fog. They are unsure what their next step should be, or what it might lead to.