Great question. For simplicity let’s assume the underlying “real” exchange ratios are the same, and the only thing changing is the nominal price level. (In the real world you can’t really speak of a price “level.”)
So long as the nominal rate of price deflation is lower than the real interest rate, there’s no problem.
E.g. suppose with stable prices, the market rate of interest would be 5%. Then if prices are dropping by 2% per year, the market rate of interest can simply drop to (about) 3% and everything works out.
Where things get tricky is if the market rate of interest under stable prices would be 5%, but prices are falling at (say) 7%. Generally speaking you can’t have negative nominal interest rates. Rather than lending out $100 in order to get $98 back (which is still a real return of about 5%), people with cash would do better to sit on their $100 which will still be $100 next year.
Even here, this wouldn’t cripple investment, because the prices of higher-order goods could fall, so that people were willing to invest in factors of production in order to sell the output down the road for the expected prices. However, it *could* be tricky to get equilibrium in the market for cash loans, given the numbers I just made up.
If you don’t mind, please read our section about deflation in the context of Bitcoin in this free PDF, and I’d be happy to answer follow-ups.
Note, I am answering a slightly different question from what you asked. In general it’s not impossible for someone to get back enough money to pay back a loan, because cash can turnover multiple times per year. To see why, check out this article.