Ever wonder why certain businesses won't accept certain credit cards? (The sign above the register saying "Sorry, we don't accept AmericanExpress"). It's because they don't want to pay that credit card company's transaction fees.
One of the roles of the credit card company is to facilitate the transaction process between the customer (you) and the store. And now that using credit cards over cash or check is so ingrained in our culture, it creates extra work for the customer to make purchases at an establishment that is cash-only.
Credit card companies know this, and so do businesses. So businesses will partner with credit card companies so that customers can use their cards. This way, everything is handled electronically (this can also benefit the business, since there's added security as they're not dealing with cash directly, and they don't have to manually count as much cash later).
However a business may only budget a certain amount of their profits they want taken by credit card transactions. So if a company's fees are too high (say AmericanExpress, for example) and they are banking on you already having a Visa card, the company isn't going to go out of its way to provide the AmericanExpress option for you.
If it were free for the business to use a credit card company's service at their stores, then they would all just provide the option for every card! So the credit card company making money is all contingent on you spending your money by using their credit card. You use the card, and the store pays the company for the transaction.