either the buyer (you) exits the contract and lose the deposit and hoping the seller does not sue you for executing the contract( they have rights to do so but i doubt it if you write down your reasons for backing out ).
or get contractors asap to do estimates on the repair cost ( it won't look like small one when it's coming to foundation work ) and keep the deal, after all you still have 9 more years before you face the problem.
not enough due-diligence work upfront and never ever sign an non-contingency contract.