Essentially, a foil does the same that an antagonist does, but a foil is not always negative. Foil characters make a character seem stronger, sadder, weaker, greedier, whatever. Antagonists can be foils, but almost any other character can be a foil, too.
When I think of foil characters, I think of my family. Do not misunderstand me. I love my family dearly.
Let me explain. As much as I love my family, we are each other's foils. Given the right moment and the right word, my sisters can make me feel like a quivering teenager with the coping mechanisms of a four-year-old. Another moment and another day, my mother can give me the strength and the courage to face battles I never knew I could battle. My father speaks words to show me impeccable paths of honor. My sisters, like any other siblings, can make my heart soar with a word of encouragement or compliment.
The best foils in literature feel like siblings, grating on the character in ways that bring out the focal character's worst hubris or supporting the focal character so as to show the focal character's most amazing possibilities.
If we start looking, we can find foils everywhere. And yep, we could talk about Luke Skywalker and Han Solo or Captain Kirk and Spock, but I'm going with the siblings for now. Some great siblings that foil each other are