Simon Legree—who is a cruel and hateful enslaver—is a foil to Uncle Tom, the novel's protagonist. All in all, Uncle Tom is depicted as a saintly hero, whereas Simon Legree is depicted as an obvious villain. When Tom arrives at the plantation, Legree vows to "break" him. To that end, Tom's refusal to harm his fellow slaves eventually causes Legree to kill him.
In the end, Legree stands for moral depravity and effectively shows what slavery looks like at its absolute worst. To that end, it's worth keeping in mind that the novel was written according to a Christian narrative—a narrative in which faith ultimately prevails over all evil. The juxtaposition that arises when Beecher Stowe compares Uncle Tom with Legree effectively illustrates the novel's larger exploration of good and evil. Even more interestingly, though, Uncle Tom’s forgiveness of Legree right before the moment of his own death serves as a kind of redemption narrative and was most likely written to appeal to Beecher Stowe's Christian audience, who would have believed very strongly in the value of forgiveness. That Uncle Tom finds it within himself to forgive his own murderer is a deeply Christian plot point that not only presents him as a pious person but also shows his moral superiority.
Topsy is a foil for Eva, the beloved and religious daughter of the St. Clare family. Eva and Topy represent two alternate upbringings and experiences as young girls. Eva is a white girl who has been protected and sheltered from the cruelties of slavery. For her entire life, she has always received nothing but love and affection from the people around her. Topsy, on the other hand, has experienced neglect and abuse as a child, and she is generally characterized as troublesome and disobedient. In this regard, she and Eva stand in stark contrast to one another.
Topsy believes she is inherently "bad," a product of her experience of slavery. However, when Miss Ophelia adopts Topsy, Eva's patience and affection eventually has a positive effect on her. Through Eva's love, Topsy loses her "callous indifference" and gains "sensibility, hope, desire, and the striving for good." All in all, Eva functions as a martyr in the novel, and her relationship with Topsy serves as a good example to readers: Eva is able to see the goodness in Topsy, and through her, both Topsy and Miss Ophelia learn something about what it means to be "good." This, it seems, is a message that Beecher Stowe was eager to impart to her readers, as it ultimately encouraged white people to use their privilege for good. At the same time, though, it's worth noting that the celebration of Eva in contrast to Topsy creates something of a white-savior narrative and thus runs the risk of robbing Topsy of any kind of agency or ability to change on her own.
Miss Ophelia and Marie St. Clare are foils to one another. From the northern state of Vermont, Miss Ophelia is stern, hard-working, and religious. Although she believes slavery to be wrong, she is still prejudiced against the enslaved. All in all, Miss Ophelia represents a northern abolitionist perspective.
In contrast, Miss Ophelia's cousin Marie is a classic southern belle: emotional, needy, and pampered. She believes enslaved people belong to a "degraded race," and she has little to no empathy for them. However, Marie's views change when she adopts Topsy and eventually learns to love her like her own daughter.
All in all, the two cousins represent differing attitudes when it comes to morality and slavery, specifically differences between the North and South. Uncle Tom's Cabin was written during a time of increasing debate over the institution of slavery. The recent passing of the Fugitive Slave Act meant that northerners were even more complicit in the system of slavery. In writing Uncle Tom's Cabin, Beecher Stowe wanted to depict as many sides of slavery as possible, as evidenced by the foil pairing of Miss Ophelia and Marie St. Clare.