There are several theories for this.
One theory says that the phrase "God Bless you" came from an Islamic practice which originated over 1400 years ago. According to the Islam religion, when someone sneezed, he should say "All Praises to God" and in response the people would reply "May God Bless You".
Another explanation is that when people sneezed it was believed that the heart would miss a beat; in that microsecond, the skip would allow the devil to enter the body. Therefore, saying "God bless you" would stop the devil from entering one's body uninvited.
Another middle ages superstition held that, when one sneezed, a large amount of breath (regarded as the very breath of life) could be expelled suddenly from the body, resulting in death. In case the victim died in this instance, he/she would at least go to heaven with God's Blessing.
Written records state that the saying goes back to the time of Pope Saint Gregory I, or Gregory the Great, who was Pope of the Catholic Church from September 590 until he died in 604. When Pope Gregory ascended to the Papacy, it was just in time for the start of the Plague, so this Pope is unfortunately known as the patron saint of plague. He believed that constant repetition of litanies and unceasing prayer for God's help and intercession would help ward off sickness. On 16 February 590 A.D., Pope Gregory decreed that whenever someone sneezed, others should say "God bless you" in response. The blessing was given in the hope (or belief) that the one who sneezed wouldn't then develop the plague.
Perhaps there was more to this than people realised: it is interesting to note that the plague of 590 A.D. dissipated very quickly.