Please add the source of this information. As far as I know magnesium is only used in some types of organic solar cells which are not commercially available. That magnesium would cause cancer is also new to me. Magnesium is an element that your body cannot do without.
That is why CdTe thin film PV module needs to recycele after service lifetime and to prevent Cd inside module contaminating environment when module is broken..
Dear Vivekanandan , the question needs to be justify in terms of environmental effect of solar module , pre and post fabrication of these module .Recently Ministry of Renewable Energy had conducted environmental impact assessment for both Solar PV & Wind Energy. For making Solar Module Mercury & cadmium ((Cd-Te )emitted apart from GHG during the production of module .Its emission includes in the assessment of life cycle environmental effect of SPV plant .
Just to be sure that you don't think all PV modules contain cadmium: CdTe PV modules had a market share of 17% in 2013 (http://www.ise.fraunhofer.de/en/downloads-englisch/pdf-files-englisch/photovoltaics-report-slides.pdf) so the large majority of solar panels do not contain cadmium.
Now that you know the important keywords I think you can use Google (scholar) to find more information.
Dont forget the social impact of renewable energy systems. We studies the impact of renewable energy structures on tourism and the effects are quite severe: