In Huckleberry Finn, Mark Twain analyzes the religion, ethics, and morality of a racist society through the development of the moral consciousness of Huckleberry himself, as well as through Huck's growing awareness of the humanity of the slave Jim. The use of a child as narrator allows Twain to report events very matter-of-factly, without moralizing about them, because Huck's immaturity does not allow him to fully understand their significance. It is our job as readers to note the transformation of Jim from a superstitious stereotype at the beginning of the book to a fully-developed character at the end, and to recognize in this transformation a strong and powerful condemnation of racism.
To begin with, Jim is the property of the most pious, Bible-thumping woman in Huck's life -- Miss Watson -- and Huck's entire society would back up her ethical right to own him. Although Miss Watson is definitely not Huck's favorite person, the boy initially rebels only against her attempts to "civilize" him, not against her ethics; when she tells him about the horrors of hell -- the "bad place," Huck calls it -- he innocently asserts he wants to go there because Miss Watson says she wouldn't go there for the world, and he concludes that anywhere Miss Watson wasn't sounds like a good destination to him. There is absolutely no indication that Huck finds anything incongruous about Miss Watson's owning a slave, and every indication that he does not.
For at this point, Huck does not really see Jim as a person, merely a "nigger", someone to play tricks on. In Chapter Two, Huck and Tom are sneaking out of the house when they come upon Jim. Fearing that he may tell on them, they hide, but Jim hears them and resolves to sit right down under a tree and wait until the source of the noise shows itself. The boys remain perfectly still for so long that Jim falls asleep. Tom sneaks up and snatches Jim's hat off the sleeping man's head and hangs it on a tree above him.