Ham comes from pigs, which is considered an unclean meat which is felt not good for the body. More, it is one of the forbidden foods a Muslim is never supposed to eat. The religion actually prohibits a small number of foodstuff, mattering in large part how they are caught and prepared incorrectly, as well again some animals simply being seen as unclean/unsafe to eat.
Plus back in the older days the pig was not yet domesticated and a boar was a very dangerous animal. Even now a wild pig or a even a domesticated boar are very dangerous and can kill or maim you pretty bad. Thus I think that had a lot to do with the pig being a forbidden meat. They did not want their people being killed by such a dangerous animal.