This quote is sometimes provided as an “it’s been said” sort of attribution, without any citation, and there are multiple variants of the wording itself.

Generally, it is understood to originate in the writings of the Spanich-American philosopher George Santayana (1863-1952). In his five-volume work The Life of Reason: The Phases of Human Progress (available online courtesy of Project Gutenberg), he offers these words (the source of the quote is highlighted):

Progress, far from consisting in change, depends on retentiveness. When change is absolute there remains no being to improve and no direction is set for possible improvement: and when experience is not retained, as among savages, infancy is perpetual. Those who cannot remember the past are condemned to repeat it. In the first stage of life the mind is frivolous and easily distracted; it misses progress by failing in consecutiveness and persistence. This is the condition of children and barbarians, in whom instinct has learned nothing from experience. In a second stage men are docile to events, plastic to new habits and suggestions, yet able to graft them on original instincts, which they thus bring to fuller satisfaction. This is the plane of manhood and true progress. Last comes a stage when retentiveness is exhausted and all that happens is at once forgotten; a vain, because unpractical, repetition of the past takes the place of plasticity and fertile readaptation. In a moving world readaptation is the price of longevity. The hard shell, far from protecting the vital principle, condemns it to die down slowly and be gradually chilled; immortality in such a case must have been secured earlier, by giving birth to a generation plastic to the contemporary world and able to retain its lessons. Thus old age is as forgetful as youth, and more incorrigible; it displays the same inattentiveness to conditions; its memory becomes self-repeating and degenerates into an instinctive reaction, like a bird’s chirp.

Others, of course, offered similar quotes. Winston Churchill is said to have included a similar phrase (“those who fail to learn from history are condemned to repeat it”) in a speech to the British House of Commons in 1948. I have not been able to find the text of a specific speech that contains this quotation, although finding the full text of his speeches – those not contained in compiled volumes, at any rate – is surprisingly difficult.