They wanted to encourage trade across their lands.
They needed them to issue letters of credit.
They required them to verify business contracts.
They used them to discourage dhimmis from trading.
Why might governments in states along trading routes have sponsored caravansaries?