If you lose your home in a foreclosure sale, you repay the credit only up to the amount of any gain you might recognize on the foreclosure.
You should file IRS Form 5405 (Repayment of First-Time Homebuyer Credit) with your 2016 Federal Tax Return. This will report that you have sold the home to the IRS. To complete the form, in Turbo Tax, you still need to go through the First Time Home Buyer Credit section. You will enter the information on the Lender Foreclosure amount and your cost basis in the home. If the foreclosure amount is less than your cost basis in the home, you will have a loss on the foreclosure. If you have a loss on the foreclosure, you will not need to repay the first time homebuyer credit.