This bit comes from Hilbert’s address Naturerkennen und Logik given in Königsberg on 8 September 1930 to the annual meeting of the Society of German Natural Scientists and Physicians. A four minute excerpt from the speech was played on the radio, the recording, German transcript, and English translation are available online, courtesy of James Smith and MAA. Unfortunately the excerpt does not include the relevant passage.
But it is quoted in Reid's book:"In an effort to give an example of an unsolvable problem, the philosopher Comte once said that science would never succeed in ascertaining the secret of the chemical composition of the bodies of the universe. A few years later this problem was solved... The true reason, according to my thinking, why Comte could not find an unsolvable problem lies in the fact that there is no such thing as an unsolvable problem". Auguste Comte is the father of sociology and the founder of philosophical positivism who wrote in his
Cours de Philosophie Positive (1835):"We understand the possibility of determining their shapes, their distances, their sizes and their movements; whereas we would never know how to study by any means their chemical composition, or their mineralogical structure, and, even more so, the nature of any organized beings that might live on their surface. I persist in the opinion that every notion of the true mean temperatures of he stars will necessarily always be concealed from us". As it happens, Joseph Fraunhofer studied the line spectra of the Sun and some bright stars in 1814 and 1823. In 1849 Foucault observed the coincidence of D lines in solar spectrum with the lines emitted by sodium in the laboratory, which led Kirchhoff to the expected conclusion a decade later. In 1860 Bunsen published a study of the emission line spectra of many chemical element, opening the way to systematic analysis of solar composition. See Hearnshaw's
Auguste Comte's blunder.
But Comte was not the primary target of Hilbert's speech, it was a philosophizing physiologist Emile du Bois-Reymond (not to be confused with his brother Paul, a mathematician), and his motto "ignoramus et ignoramibus", we are ignorant and we shall remain ignorant. Hilbert ends his address in a forceful rejection of the sentiment, now famous:"We must not believe those, who today with philosophical bearing and a tone of superiority prophesy the downfall of culture and accept the ignorabimus. For us there is no ignorabimus, and in my opinion even none whatever in natural science. In place of the foolish ignorabimus let stand our slogan: We must know, We will know".