The contract is void under Art. 5 of the Civil Code, which states that acts contrary to mandatory or prohibitory laws are void. Contract performance requires adultery, a crime in the Philippines.
Moreover, both parties could be prosecuted (the void contract held as a conspiracy) and the object or effects of the crime forfeited to the government. Art. 1411, Civil Code.