I was reading about early Islam (Reza Aslan's 'no god but god'). It's not a rule that has aged well, but according to him the reasoning was that basically in pre-islamic arabia if you didn't have family support (e.g. widow, orphan), you'd have no livelihood, would end up borrowing money and then fall into slavery. In the absence of financial markets, bankruptcy laws, social safety net, free markets for labour/entrepreneurship, forbidding usury potentially made sense.
As an economist, I still think consumer lending (excluding consumer lending that is actually funding investment like mortgages and vehicle financing) in 2022 is pretty questionable and only economically logical in a minority of cases, and that it would make sense to restrict/regulate some of it more heavily.