You can't get money on the Ripple network unless you trust someone to owe it to you. To have $100 in the Ripple network, someone must owe you that $100. If you haven't chosen to trust anyone to owe you money, nobody can owe you $100 and thus you can't have any money.
So when you give money to a gateway, you must allow them to pay you in IOUs. And if someone is expecting you to pay them money, they must allow someone to owe them that money or it's impossible for you to pay them. Now if you've both chosen to trust the same gateway, it's simple -- you just hand them the IOUs you just bought.
If you trust different gateways, then a path between those two gateways must be found. With luck, there will be someone who holds IOUs from both gateways and doesn't particularly care which IOUs they hold. So you can use them to "move" your IOUs from one gateway to another.