Two different issues here:
1) UKIP are not against immigration of skilled workers where there is a need that can't be met by UK nationals. They're against unchecked immigration of unskilled workers.
2) Most migrant workers in the NHS do NOT come from the EU so would not be affected by us leaving the EU. Most migrant workers are from the old commonwealth countries or countries we have traditional links with (e.g Doctors from India, nurses from Phillipines etc) and have to pass a points based system in order to gain employment, i.e, prove they're skilled.
So the NHS is a bit of a red herring when we're discussing leaving the EU and I actually think it's unethical employing these migrant workers because the health services suffer in their country of origin. Countries where decent healthcare is needed a lot more than here.