What is the importance of the Lydia-Wickham episode?
In this novel, Jane Austen explores the theme of how both pride and prejudice can blind people and lead them to draw the wrong conclusions. While we typically see Darcy as "pride" and Elizabeth as "prejudice," both characters display both traits and both make mistakes. If Elizabeth prejudges Darcy based on surface appearances, including his rude comment about her not being worth dancing with, Darcy prejudges Jane on surface appearances, believing because of her outward coolness that she really doesn't love Bingham.
Elizabeth's great initial blunder is to believe the charming Wickham when he tells her stories of being cheated and wronged by the proud Mr. Darcy. However, when Mr. Darcy tells his side of the story in a letter, Elizabeth, as she expresses to Jane, is then inclined to believe Mr. Darcy. At this point we don't know whose story is true: it's a classic situation of one person's word against another.
The Lydia-Wickham situation thus becomes very important because it demonstrates who is the truth-teller and who is the liar. Wickham shows through his actions—running off with and "ruining" a young girl with no intention of marrying her—what a wicked person he is. We now have every reason to believe Darcy's version of events. Further, in going to such efforts and expense to arrange the marriage of Wickham and Lydia, Darcy shows he is a person of integrity and that he is genuinely in love with Elizabeth. Wickham exposes himself as a self-indulgent, selfish loser and Darcy reveals his depth of character.
Modern audiences "know" how the story ends, but if we project back into the minds of early readers, one can imagine that doubts would linger about who was telling the truth: Darcy or Wickham. The dramatic action of Wickham seducing Lydia puts all that to rest.
Of course, this episode also drives the plot forward. It gives Darcy the chance to demonstrate the sincerity of his love for Elizabeth and to show that he has grown beyond judging her on the basis of her family's imperfections. It also kills forever any lingering feelings Elizabeth might have had for Wickham.
It leads as well to Mr. Bennet's reformation. No longer will he be so careless and uninvolved in his daughter's lives. He realizes and regrets that he has let his younger daughters rove and flirt too freely. He knows what an extremely fortunate escape from disgrace his family has had in the marriage of Lydia and Wickham.