A spray tan is safe and will not cause skin cancer. It is the exposure to UV rays that puts someone at risk for skin cancer. You are not exposing yourself to UV rays with a spray tan.
The active ingredient in spray tans is DHA, a glycerin derivitive that binds with dead skin cells. The reaction between DHA and dead skin cells cause cells to darken, giving the illusion of a tan.
The skin continuously sheds dead skin cells, so spray tans only last a week or two. It may be a hassle to have to go into the salon every few weeks to get another spray tan, but it is better than putting yourself at risk of skin cancer. Alternatively, you can try at-home self-tanner creams and gels.