Charles Darwin developed his theory of evolution by natural selection during his five-year voyage (1831-1836) on HMS Beagle. The ship's expedition, particularly his observations in the Galápagos Islands, provided crucial evidence that influenced his groundbreaking work 'On the Origin of Species.'