In general, yes, perfectly safe. But acid in food can eat into foil, so if you are wrapping, say, a fruit cake laced with spirits, oiling the foil or wrapping the food in greaseproof paper first will prevent this. All food for freezing should be wrapped tightly in foil so it is completely airtight.
Foil should not be used in the microwave, but is fine for using in conventional ovens, when you can put either side, matt or shiny, next to the food. Foil can be used to protect food from burning: for instance, place a piece over the head and tail of a fish, or the breast of a bird, while it is being baked or roasted. If you are wrapping food in foil for cooking, seal the parcel tightly but leave it loose to allow the air inside to circulate and cook the food evenly. And do not stretch foil tight across the top of a dish: put a pleat in the top to allow for expansion.