Jim has a reason for telling the story of his deaf daughter and Twain may have an additional reason.
Jim is teaching Huck a lesson through this anecdote. Huck has been cruel to Jim, playing tricks on him and abusing his sympathies. Jim tells Huck about how he (Jim) had mistreated his daughter before discovering that she was deaf. The mistreatment was carried out for lack of understanding - lack of empathy - and Jim learned a valuable lesson. He learned to be patient.
He learned that other's limitations must be accepted and adjusted for if one is to treat others fairly. Importantly, this is a lesson of humility.
Twain's reason for including the story may be related to humility as well.
While we may be tempted to interpret Jim's demeanor as one of servility and socially instructed humility, this story allows the reader to see that Jim's humanity and humility may come from a source in his personal life, not in his social life. He is not humble and caring because these are the qualities demanded of him as a slave or servant.
He is humble because he has hurt someone dear to him and does not want to do that again. He is humble because of his daughter, Lizbeth.
Though we can only confidently offer Jim's reasons for telling the story, we might reasonably surmise that Twain uses the story for character development in this way as well.
This second, developmental function is in keeping with the reading that some scholars give to Jim's character.
Jim...serves the function of making Huck confront his conscience...
Were Jim merely a humble servant, made humble through social conditioning, not a man who has learned humility through empathy, he would be far less capable of standing as a moral exemplar for Huck. Were this the case, he would be, simply, less good.