At first glance, Eddie Mars appears to be the antagonist, and in many ways he is the novel's villain. He's indirectly involved in nearly all of the murders that take place in the novel, but he gets away without being punished because he hires men to do his dirty deeds for him. But the reason we're calling him the foil is because of his relationship to Marlowe.
Mars and Marlowe have several similarities and differences that serve to further characterize each of them. They're both tough guys, who rely on their wits to get through life. But that's kind of where the similarities end. Mars is about as dishonest as Marlowe is honest. All the shady dealings and murderous schemes that Mars is mixed up in act as obstacles or mysteries that Marlowe has to fight through or solve. We never find out exactly what happens to Mars in the end. We only know that Marlowe isn't able to pin anything on Mars so he gets away scot-free.