It was developed by the University of Arizona as a way of protecting against melanomas - it's an analog of a-MSH, a hormone that occurs in our bodies and binds with melanocortin receptors to stimulate pigmentation. Melanotan is approximately 1000 times more potent than a-MSH, however! The theory behind it is that if you stimulate pigmentation at an elevated rate, you're less susceptible to sun damage.
There are 2 types of melanotan - one of them only produces pigementation (Melanotan-I) by binding to a certain MC receptor (I forget which). The other (Melanotan-II, the most commonly consumed of the two) binds to MC5R, which also affects inflammation, libido, appetite and energy homeostasis.
Melanotan is not FDA or TGA approved, but I believe there are trials underway here in Australia to produce a tanning implant and nasal spray - though this could be the Melanotan-I varient, I'm not sure. The only studies that I've found for Melanotan-II were based around impotency!
This is all from memory, btw, so I'd recommend doing your own research if you're seriously considering it.