How can I attach a metal soap dish to tile?
My approach (depending on the mating surface available, shape, etc.) would be to use pure "clear" silicone along with a bit of foam tape. 

Cut a small piece of foam tape to act as a temporary anchor while the silicone sets. Place it in the center of the soap dish back panel in a location that allows you to apply a bead of silicone entirely around it (to effectively seal it in). 

Once the silicone is applied to the back of the dish, stick the dish to the wall and press firmly. Wipe any extra sealant from the wall and dish. 

Optionally, once the silicone sets (2-4 hours should do), run a small bead around the dish to seal it further and improve appearance.