In Western Europe in the early Middle Ages, science was often seen as a way to reinforce theological beliefs rather than as a means of discovery in its own right. Many of the advances made in Classical times were lost and scholars had to make do with a limited and less-than-ideal selection of texts. Nevertheless, calling this period the "dark ages" is hardly warranted. The myth of early-medieval ignorance was reinforced by the humanists and their heirs, who often drew on the discoveries of earlier European scientists without acknowledging them in order to make their own achievements seem more remarkable. James Hannam in God's philosophers (2009) charts the development of science in Europe and shows it to have been a continuous process, extending from Classical times to the modern era, and demonstrates that the Church more often fostered scientific discovery than prevented it.
In the Islamic East the state of scientific scholarship in the early Middle Ages was better, with Islamic rulers sponsoring the translation of the Classical texts into Arabic and supporting the establishment of universities in cities such as Baghdad and Cordoba. Islamic advances in science from this time laid the foundations for many later Western advances. (The recent exhibition at the Science Museum, 1001 Inventions, charts this influence - the website and promotional film can be accessed here.)
One of the most important elements of the Islamic legacy was the development of Arabic numerals and the number 0. Using Arabic rather than Roman numerals made calculating things an awful lot easier. Mathematics developed quickly once Arabic ideas such as these filtered into Europe through the mixed societies of Moorish Spain and the Crusader Kingdoms in Palestine. Notably Al-Khwarizmi (Alghorismus, c780-c850) made huge strides in the use of algebra and invented the list of instructions for calculating a function that became known as an algorithm.
A Copernican revolution
In medieval Europe, Copernicus (1473-1543) read the work of Classical philosophers such as Aristotle and Euclid, as well as that of Islamic philosophers such as Ibn Rushd (Avveroes). He saw contradictions in the accepted model of the universe and developed his own, heliocentric, model of the universe (ie one in which the earth revolves around the sun), which was published shortly before his death.
Galileo - breakthrough and charge of heresy
According to Stephen Hawking, "Galileo [1564-1642], perhaps more than any other single person, was responsible for the birth of modern science." In 1610 Galileo began to champion the heliocentric model of the universe put forward by Copernicus and, in doing so, began a scientific revolution or paradigm-shift. In 1632, after a bitter battle with the Inquisition, Galileo published his Dialogue concerning the two chief world systems. This brought his opposition to the Church to a head and he was placed on trial and forced to retract his views and live under house-arrest until his death.
Despite the Church proclaiming the heliocentric (sun-centred) view of the universe "false and contrary to Scripture", it soon became the dominant view among scientists and gave rise to an explosion in scientific ideas which led to the Enlightenment. By the mid-eighteenth century the Church had stopped opposing Galileo and by 1939 Pope Pius XII said that Galileo was one of the "most audacious heroes of research ... not afraid of the stumbling-blocks and the risks on the way, nor fearful of the funereal monuments." In the 1990s both Pope John Paul II and Cardinal Joseph Ratzinger (now Pope Benedict XVI) expressed regret over how the Church reacted to Galileo.
Enlightenment: the world as a predictable machine
During the Enlightenment scientists developed a view of the universe as an orderly, vast and complicated but predictable machine. Newton, Kepler, Pascal, Halley, Herschel and Hooke contributed to a more and more complete understanding of the world; indeed by the nineteenth century scientists were speculating how long it would take them to find out everything and so do themselves out of a job.
Doing God out of a job
The mechanistic view of the universe was at once a blessing and a threat to religion. On one level, science confined itself to discovering how things worked and religion supplied the why. Nevertheless, the more that science provided a "theory of everything", the less need there was to believe in God, particularly a God who has any meaningful role in the universe. Deism (the belief that God created the universe but is distant, not interested in us) or atheism, was a natural conclusion of scientific research in this paradigm.