I saw an explonation which is written by cassie-1-2-3 and I think it's explain everything:
"I was thinking more along the lines of a scientific explanation. They have dense bodies. Diamond is the most (or one of the most) dense material on Earth. This would suggest that they have diamond type skin cells. The angle of refraction is high in diamonds, so they refract light, which causes sparkling. I can't develop a trail of thought like that when I think about vampires burning or turning to ash. Unless it's something that just is."
She posted it on "Critical Analysis of Twilight"'s wall.
im not 100% sure to tell you the truth i think its probably something to do with reflection, their skin is pale white and ice cold so when the sun hits it it is warmth which does strange things to the body or reflection of the paleness when colour hits it thats my theory but im not sure
Stephanie Meyer didn't want to go with the traditional idea of vampires bursting into flame when they're hit by sunlight. Maybe she thought that'd be too weak. So she had to come up with something else, a reason why they'd avoid sunlight which would have caused the false belief. She came up with sparkling and its exposure risk. Also, as mentioned in TSSLOBT, from a distance the sparkling could be mistaken for fire.