First, Pasteur is famous for many contributions to microbiology, including his experiments showing that the microbes that cause fermentation and food decay are living organisms that generate from other living organisms. Before Pasteur, there had been considerable debate as to what caused fermentation. Pasteur showed conclusively that the microbes that cause it generate from parent microbes, and that they do no appear spontaneously. Did Pasteur prove that spontaneous generation is impossible in all possible circumstances? No, of course not. Pasteur did not test all possible circumstances! That would have been impossible. He tested only sample circumstances that were representative of his world, and applicable to his study of fermentation and decay. That does not prove that life could not have originated on its own in circumstances that differ with the tests done by Pasteur. In Pasteur's own words,
I looked for spontaneous generation without finding it, but I do not believe it to be impossible. (Source: Louis Pasteur: The Man and his Theories, p 90)
If I had the honour of being a surgeon, convinced as I am of the dangers of which we are exposed by the microbial germs on the surfaces of all the objects about us, especially in hospitals, not only would I use absolutely clean instruments but, after washing my hands with the greatest care and submitting them to momentary contact with a flame... I would use no lint, bandages or sponges which had not been exposed to air at a temperature of 130 deg to 150 deg. (ibid., p168-169)
We still do not know how life originated, although we have made much progress in studying the problem. The latest issue of Scientific American, for instance, includes an article describing how simple self-replicating molecules may have started the process.
Showing that life does not originate spontaneously in a modern garbage dump by no means proves that it could not have originated in far different circumstances over millions of years.
Religions, philosophies, atheism, materialism, or its opposite--none of these is relevant ot the matter...I might even add that, scientifically speaking, I am indifferent to them all. The question is purely one of fact. I approached it without preconceived ideas, as ready to admit, should experience compel me to do so, that spontaneous generation existed. (ibid, p 89)
This is the true essence of science: the honest search for truth, regardless of what it means to one's preconceived ideas.
Now let's look again at the controversial quote:
Virulence appears in a new light which cannot but be alarming to humanity; unless nature, in her evolution down the ages (an evolution which, as we now know, has been going on for millions, nay, hundreds of millions of years), has finally exhausted all the possibilities of producing virulent or contagious diseases -- which does not seem very likely. (ibid, p. 122)
The controversy is whether the parenthetical phrase mentioning millions of years was actually written by Pasteur. At this blog, "Honey" argues that the book that this quote comes from sometimes inserts words in parenthesis that do not appear in the original quote. Further, she points out that an almost identical quote appears at The Life and Works of Louis Pasteur, but it does not have the phrase in parentheses. I have paged through that book, and it is indeed possible that some of the comments in parenthesis look as though they may be explanatory material added by a translator or commentator, but I do not know. Particularly, I cannot tell if the phrase in question is part of the original quote or not. Accordingly, I have noted that on the web page where I quote it.
The main point is that Pasteur promoted the teaching of evolution in that passage. I assume that Pasteur also believed that the earth was millions of years old, but I have no direct proof of that.
In closing, here is another quote from Pasteur:
If I had to live my life over again, I would try always to remember that admirable precept of Bossuet: "The greatest disorder of the mind is to believe that things are so because we wish them to be so."
Pasteur was truly a mind set free!