What is the purpose of wrapping fish with aluminum foil?
Cooking fish or other items in paper, "en papillote" is a technique used to lock in moisture and basically steam the fish in its own moisture and any aromatics you add.  Using foil is often done in the same way and to remove the fish or other items from more direct drying and scorching effects of heat while cooking, much as you might use foil on poultry breast to try to prevent burning while getting the slower cooking thigh up to temp.

If by covering with salt, you mean directly to the fish or other item and either using a bed of salt or burying them in it, one point is to flavor of course, but also to draw out some moisture.  Both in this case, and if the item has been wrapped so the salt does not actually contact the food, the idea I have always learned is to even out the temperature and turn it into more of an indirect heating.  The goal in this case is to try to get to temperature again without scorching or open drying of the item and get a more even heating in theory.