Once people have seen that something happens through observation, sooner or later it will occur to them to ask why it happens, and whether there is any way of proving that it will happen the same way every time. The Egyptians, according to Herodotus, used experiments to see what would happen in a certain situation. For instance, he reports that the Pharaoh wanted to find out what the first language on earth was, and so he ordered two babies to be put in a house alone, and the slaves who took care of them should not speak at all, to see what they would say first.
In the classical period in Greece, Pythagoras was interested in proving that things were true all the time, rather than just observing that they were true most of the time. Socrates began to develop a way of thinking and speaking which would let you prove that a certain statement was or was not true, which we call logic. Socrates' student Plato continued this idea, and Plato's student Aristotle began the process of applying this logic to the natural world.
In the Hellenistic period, many Greek philosopher-scientists like Euclid and Aristarchus used Aristotle's logical system to investigate mathematics, biology, physics, astronomy, and medicine. These studies took place all over Alexander's empire, but especially in the great Library at Alexandria in Egypt.
When the Romans took over Greece and Egypt, they became great admirers of the Greek scientific process. The Library at Alexandria remained open. But really not as many great advances in understanding the natural world were made during the Roman Empire. The Romans were more interested in practical engineering, and more people studied that. With the conversion to Christianity in the 300s AD, there got to be a lot of hostility to the Library, which was seen as a stronghold of paganism, and eventually, around 600 AD, the Library was shut down.
After the Islamic Empire was established in the late 600s AD, scientific research took off again. In physics, Ibn Sina figured out the basic natural laws governing motion and momentum in the 900s AD. In the 1100s AD, Maimonides realized that people got sick from bad water and air (though he didn't know about germs), rather than from magic spells or curses. Ibn Rushd, at the same time, tried to use logic to figure out the nature of the soul.
During this time in Europe, little or no scientific progress was being made. People in Europe could barely read or write. But by the 1100s AD, Europe was for the first time becoming a center for scientific thought. Monks, in the role of professors, were teaching Socratic logic to students in the monastic schools and cathedral schools (the beginnings of modern universities) at Paris and Cambridge and Oxford. Men like Peter Abelard tried to use logic to prove the existence of God, and to define His nature. At the ducal court of Aquitaine, Eleanor of Aquitaine and her court used the same logical principles to discuss the nature of love.
By the 1200s, there were increasing connections between Islamic and European scholars. Thomas Aquinas imitated the work of Maimonides, Ibn Sina and Ibn Rushd to build a more logical version of Christianity. In the next century - the 1300s AD - Ibn Khaldun in North Africa applied logical principles to the study of history and economics, breaking new ground.
Logic and the Scientific Method
Where does God fit in?
History of Science