How can fruit flies and mice share the same gene that says to build an eye if they evolved separately?
Both fruit flies (Drosophila) and mice (Mus) are classified  under Bilateria.
The presence of such a highly conserved sequence in both species suggests that they share a urbilaterian ancestor who also used a similar gene to turn on eye formation (not create the whole eye, just start the process).  

Even though the structure of insect and mammalian eyes diverged evolutionarily after the common ancestor, the switch that starts eye development worked so well there was little need to change it.  I suppose one could say that it remains backwards compatible.