Timeshares come in different formats, so it will be impossible to project the impact of discontinuing payment. I strongly suggest that you closely read any documentation you received regarding the timeshare to see if any terms address this situation. It may well be that your interest may just be terminated without any more formal action.
Having said that, I cannot imagine any consequential negative impact that the loss of your timeshare interest would have on your credit. This is dissimilar from the typical Trustee Sale under Deed of Trust scenario which constitutes the vast bulk of "foreclosures". The answer to your initial question of how you can get out of it is simply, don't pay. The addition of further factual details might, of course, change the specifics of this answer.
Try to sell it back to the timeshare company or sell it someone else. If not, stop paying and you will lose it. However, like not paying any creditor, it will hurt your credit.
[This communication is intended as general information and not specific legal advice, and this communication does not create an attorney-client relationship.]
To clarify what I had written before, your timeshare documentation may well reflect a liability for additional payments which could impact your credit or simply that you lose your continued use of the timeshare upon failure to pay with no continuing obligation to pay, which would not affect your credit. Even if an indebtness should remain, many timeshare administrators do not report such to a credit reporting agency. In this time of economic uncertainty and the dramatically increased incidence of foreclosures, it would be very difficult to quantify any specific impact on your credit rating. Actually, this applies to the impact of residential Trustee Sales as well. One other factor to consider is the potential tax consequence if there is a remaining indebtedness that can be collectable. If the creditor files a 1099 with IRS, there may be a tax eventually assessed for forgiveness of indebtedness. Again, we don't know enough from the facts given.