Levin is a foil for Vronsky. In Levin we see an example of a devoted and attentive husband, and we can contrast him with Vronsky. For instance, while Levin experiences acute pain on Kitty's behalf when she's giving birth, Vronsky goes to the elections quite unconcerned about Anna's tortured state of mind. Similarly, Levin highly values family, while Vronsky participates in breaking up Anna's family.
Kitty is young, innocent, uncorrupted – everything that Anna is not. At the beginning of the novel, eighteen-year-old Kitty looks up to Anna because she is a fascinating, elegant woman. But by the novel's end, Kitty can only regard Anna with pity. Kitty's happy, wholesome marriage with Levin contrasts in every way with Anna's unhealthy relationship with Karenin and the tortured passion she shares with Vronsky.
Dolly acts as a foil by occupying an in-between position. She's not the cherished wife that Kitty is, nor has she renounced married life. Instead, she lives in a disillusioned marriage. She made the compromises that Anna does not make to save her marriage and her family.
Oblonsky is a foil for similar reasons that Dolly is. His marital situation is different from both Levin's and Karenin's. His urban excess and sophistication, furthermore, provide the city mouse counterpoint to Levin's country mouse.
Oblonsky also serves as a foil for his sister, as he too commits adultery. But Oblonsky's multiple adulteries are different from Anna's, and don't lead to his downfall. This shows that it's not just adultery per se that destroys Anna, but something about her adultery in particular. Perhaps it's the simple fact that she is a woman living in a judgmental society; perhaps it is something much more complicated.