Mr. Micawber is Comic Relief – in the grimmest part of the novel, when David has been cast out by his stepfather and is basically roaming the streets of London, in steps Mr. Micawber to lighten the tone of the novel a bit. David meets Mr. Micawber when he first moves to London to work at Murdstone and Grinby. Mr. Quinion finds David a place to live by renting him a room in Mr. Micawber's house. David and Mr. Micawber become instant friends, primarily because Mr. Micawber cannot seem to remember that David is only ten years old: he constantly brings his financial troubles to David, as though David could give him sound advice or assistance as a ten-year old.
The thing about Mr. Micawber is that he is incredibly eloquent and well-spoken, but he is also criminally bad with money. He'll stand in front of David and give these amazing speeches about his prospects and about the State of England today and so on – but he never seems actually to get a job like a normal person (well, except when he works for Uriah Heep, but we'll get to that in a second). As Traddles points out, Mr. Micawber "would appear not to have worked to any good account for himself" (54.37) – he's gone energetically from profession to profession and from place to place, but he's never actually made a tolerable living.
We've all known guys like Mr. Micawber: really funny and nice, but constantly mooching, borrowing money, and avoiding collection agents. But Mr. Micawber takes it to the next level of extreme: he actually gets arrested for all of his debt troubles while David is still living with him in London.
Debtors' prison is a Victorian institution that allows whole families to share a cell with the head of the household who has been imprisoned, so the Micawbers all pile in to Mr. Micawber's tiny cell. But it's only after David's relatively stable (though miserable) London life has been shaken up by this arrest and the Micawbers' subsequent decision to leave London to look for work in Plymouth that he finally decides to run away to his aunt. Mr. Micawber's debt-running-up ways provide a reason for David to ditch London for Dover.
The other useful thing about the Micawbers' stint in debtors prison is that we see the best side of Mr. Micawber's character, a point that becomes important later in the novel. Yes, he cannot get it together on his own family's behalf, but he'll work his butt off for other people. While Mr. Micawber is in debtors prison, he and several of the other inmates draft this amazing letter to the House of Commons petitioning for a change in the laws dealing with debt.
Seeing all of this energy directed at something that can't possibly profit Mr. Micawber directly, David observes that Mr. Micawber is "a thoroughly good-natured man, and as active a creature about everything but his own affairs as has ever existed" (11.67). Or as Traddles puts it much later, "he is a most untiring man when he works for other people" (54.37). Mr. Micawber is totally thankless when it comes to managing his own life, but he is incredibly active and dedicated when he has to help other people.
It's this self-sacrificing nature that makes Mr. Micawber go against all possible profits to turn in Uriah Heep to David and Traddles. Later on in the novel, Mr. Micawber agrees to become Uriah Heep's law clerk because he has no other prospects and Uriah Heep offers him a ton of cash. Uriah Heep thinks that he's got Mr. Micawber by the short hairs because he has been regularly paying Mr. Micawber's debts for him.
But Uriah Heep underestimates Mr. Micawber's horror at the way Uriah Heep has been treating the Wickfields. He cannot understand that poor Mr. Micawber, whose whole character up to this point has been bound up in money (or the lack thereof), still has too much sympathy for others to be a true villain. Mr. Micawber gets to win out over the blackmailing Heep because he is a human being, where Uriah Heep is like a machine.
In the moral system of Dickens's novel, all of Mr. Micawber's faults – his pompousness, his vanity, his total carelessness with money – are humanweaknesses that can be forgiven. The only unforgivable fault in David Copperfield is lack of sympathy for other people, which is a problem Mr. Micawber certainly doesn't have.
Sure, Mr. Micawber causes plenty of trouble by leaving David alone in London after getting out of debtors' prison, by borrowing money from Traddles and leaving him on the hook with a collection agent, and by working for Uriah Heep in the first place. But even though he's not a perfect character, his love of other people gets him rewarded in the end. After he produces evidence against Uriah Heep, David, Traddles, and Miss Betsey all club together to buy him and his family tickets to Australia.
In Australia, Mr. Micawber finds the kind of life of which he has always dreamed: he and his family are among the most prominent members of the local community. Perhaps England is just too crowded for the Micawbers, and they needed to get to Australia to come into their own. Hilariously, in the Land Down Under, Mr. Micawber is so popular and well-established that he becomes the Port Middlebay District Magistrate – so he's a judge! Kind of a change from debtors' prison, eh?