I doubt that just because he cheated on her, means that he can get penalised. If that term is in the contract, and it was before or at the time of the purchase, it is binding-simple contract law, especially if it has been signed! Simple rule, if you sign something, you are basically bound by every term, with some exceptions.
As for the equity, thats just bad luck, people who purchased a house when the price of houses were at its peak, are the losers. It was obvious that that trend was not going to continue, and the real winners are the previous owners who sold it to you.
If you sell the house now for less than what you paid for it, then you would have to cover the loss. It seems harsh, but i can't see any other way around it. You could buy the house yourself, or maybe even share it with a friend, rent out a room etc etc, but it seems your friend is going to loose out big time.