If the amount is more than $3000 there are two procedures.
One procedure is to take a special miscellaneous itemized deduction that is not limited by the 2% rule. If you already itemize your deductions, the repayment will add to your deduction and will decrease your income tax owed. If your income and deductions are mostly similar from year to year, this will result in a tax reduction that is similar or the same to the amount of tax you paid in the previous year due to including that income. However, if you usually use the standard deduction, adding this will only give you a partial recovery of the taxes that were previously paid. Since most states use the federal itemized deductions as the basis for their own tax returns, this method will usually result in a state deduction that would reduce your state income tax.
The other procedure is to take a direct credit on your tax return for the amount of tax you paid in the previous year that was due to the inclusion of the income. You have to figure out the tax credit amount yourself, Turbotax doesn't include the calculation (you would take the original tax return that included the income, subtract out the repayment, and see how much less your tax would have been, that's your credit). To add the credit to your tax return you must be using Turbotax installed on your own computer from a CD or download so you can manually add the credit to the tax form (no manual direct edits with turbotax online). This is called an IRC 1341 Claim of Right credit. You would then have to check your state to see if the state also has a claim of right rule and how to use it to get your state tax reduced.
You can generally choose to use whichever method saves you more tax.
However, the IRC 1341 Claim of Right is only allowed if, when you originally received the income, you reasonably believed that you had an unrestricted right to the income. If you knew that the relocation bonus was contingent on working X number of years, and if you already had a pretty good idea that you might leave early and trigger the repayment, then you did not have a reasonable belief that you had an unrestricted right to the income. In that case you could only use the itemized deduction procedure and not the claim of right procedure. You don't file proof of your claim for repayment with the IRS, but you should keep any proof with your tax documents for at least 3 years (7 years is better) in case of audit. If you took the claim of right and the IRS determines that you did not have a reasonable belief in an unrestricted right, they will recalculate it for you using the deduction method.
Neither of these procedures results in a recovery of your social security and medicare tax. The only way to get that back as well would be for the employer to dock your pay in 2018 for the repayment, resulting in lower income on your W-2 and lower taxes all around due to lower income. But many employers won't do it this way.