It's Unlikely that Einstein ever said this.
The snopes page on this quote claims that the earliest reference to it is in a 1983 New York Times column:
Asked once what the greatest invention of all times was, Albert Einstein is said to have replied, ''compound interest.'' His playful sense of humor and other aspects of his personality -as well as his genius - form the subject of a bus tour Sunday to the Institute for Advanced Study at Princeton, N.J., where the physicist worked during the last 20 years of his life. [...]
I managed to find an earlier version of this quote from 1978 in Bank Performance Annual, Warren, Gorham & Lamont, 1978, p509:
Given that Einstein died in 1955, it is still unlikely that it is attributable to him. Einstein is a common target for mis-attributed quotes due to being a widely recognised "genius" figure.
While it's not an attributed quote, this "fun" question from the back of The American Mathematical Monthly, Vol. 46, No. 9, Nov., 1939, p595, invites readers to show off their Einsteinian skills by determining what has stumped mathematicians:
(The correct answer is d, and sadly not compound interest). Could it have been a question like this which was the seed from which the (likely) mis-attributed quote grew?
Quote investigator also found some earlier quotes claiming that compound interest is the "greatest invention", but none of them involve Einstein in any way until well after his death.