It's not safe to heat canned food in the can. Heating steel cans could release chromium and nickel. You could be exposed to BPAs from the plastic lining inside of the can, as well. An unopened can might explode if you heat food items on a stove top.
It is only safe to cook food in a tin can if it is not lined with BPA or any other lining. Using pre-washed tin cans that do not have any lining is an acceptable method of cooking over an open fire on the homestead. Tin cans can be used as makeshift ovens for baking.