Karl Marx wrote this statement in his book "The Eighteenth Brumaire of Louis Napoleon," which was published in 1852. Marx used this phrase to discuss how historical events can have similar patterns, but each iteration can have different outcomes or significance.