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.
If your employer does not refund the full amount, you may submit Form 843 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 in IRS Publication 519 U.S. Tax Guide for Aliens.