If you are a foreign national who works in the U.S. but is not subject to Social Security or Medicare taxes due to a treaty with your home country, you may request a refund of your Social Security and Medicare taxes from your employer if it mistakenly withheld these taxes from your wages on Form W-2 Wage and Tax Statement.
If your employer does not refund the full amount, you may submit Form 843 Claim for Refund and Request for Abatement to the IRS to claim the balance. You should attach the following documents to Form 843:
For additional information, please refer to the Refund of Taxes Withheld in Error topic on page 39 of IRS Publication 519 U.S. Tax Guide for Aliens.