Note: Before we jump into discussing Pippin in The Two Towers, you might want to take a peek at Pippin's "Character Analysis" for The Fellowship of the Ring for some background.
Pippin is still just the most adorable little tyke in the whole series. He's the youngest of the four hobbits—twenty-eight, which makes him still a kid by hobbit standards (hobbits come of age at thirty-three). But even if Pippin is the most child-like of the hobbits, a lot of the action of The Two Towers still comes to us focused through his eyes.
Pippin is the one who wakes up first when he and Merry are knocked out and taken captive by that nasty band of orcs. As the orcs carry the two of them, Pippin is the one who drops his Lothlórien brooch by the side of the track to show the Fellowship where the orcs are taking them. And Pippin gets that the Mordor orc Grishnákh knows about the Ring, which becomes a key part of Merry and Pippin's escape plan.
So even though Pippin often seems like the least serious and experienced member of the (now broken up) Fellowship, his creativity and willingness to jump into action without too much angst or forethought both turn out to be big assets (for the most part, but we'll get to the exception in a bit) in The Two Towers.
It's a lucky thing Pippin is adorable and makes friends quickly, because if it weren't for his cuteness, he would probably be in big trouble at the end of The Two Towers, when he makes one of the stupidest mistakes of the whole series—and that's saying something, considering the rock he threw down that well in Moria in The Fellowship of the Ring brought a whole mineful of orcs to attack the Company.
The stupid thing that Pippin does in The Two Towers? He looks into the palantír of Orthanc without permission, and without anyone knowing. Yeah. Not good.
We won't go into the broader importance of the palantír, the Seeing Stone, here, since we talk about it in the "Symbols, Imagery, Allegory" section of The Return of the King learning guide. Instead, we'll just focus on Pippin's foolish mistake. As soon as Pippin gets a glimpse of the palantír falling out of the tower, he wants nothing more than to look into the thing—even though it is clearly bad news.
So, that night, as the Good Guys camp near Isengard, Pippin steals the palantír from Gandalf and stares into it. As you might expect, this does not go well for Pippin. Looking into the palantír, he finds the Eye of Sauron. Whoops. Pippin is terrified, and Sauron seizes the chance to laugh at Pippin and to use his fiery gaze to bring some serious hurt down on the hobbit. As you might guess, this is plenty traumatizing for poor Pippin.
Still, in spite of the fact that this whole palantír episode could have been an absolute, total disaster, it winds up working out quite well for Team Good. Gandalf, while furious and worried—Pippin could have killed himself!—goes on to admit that Sauron seems to have misunderstood what Pippin was doing with the stone. Gandalf guesses that Sauron believes that Pippin is actually Frodo and a prisoner of Isengard, and that Saruman has forced him to look into the palantír to alert Sauron that Saruman has found the Ring.
This misguided idea that Pippin is actually Frodo, held captive by Saruman:
(a) is wishful thinking on Sauron's part;
(b) leads Sauron to underestimate what's been happening at Isengard (bonus!); and
(c) lulls Sauron into a false sense of security and relaxation (major bonus!).
If it weren't for Pippin's average, harmless-looking appearance, Sauron might have taken the time to ask Pippin more intense questions, which would have revealed, frankly, everything about the Ring quest. Luckily, Sauron thinks Pippin looks like such a fool that he doesn't bother to get suspicious. Who's the fool now, Sauron? Ya jerk.
Sauron's own arrogance keeps him in the dark about the plans of Gandalf and Company, which is great for Our Guys. And even if Pippin doesn't mean to be a huge help to the Fellowship by peaking into the palantír, he still winds up lending a hand, in his own bumbling way. Both the incident with the palantír and the hobbits' sudden friendship with the Ents go to show that Pippin and Merry are extremely lucky, even if they are not all that learned or powerful.
That luck makes them a huge contribution to the side of Good, even if they aren't as obviously wise as Gandalf or as physically strong as Aragorn. The importance of luck to their storylines might also have something to do with Tolkien's grand ideas about Religion and Fate.