In the US at least, it's partly because the money is transferred through ACH, and it's more efficient to calculate which banks owe which banks how much in big, nightly batches than it is for individual transactions. While authorizations are often in real time, they don't have to be, and it is still an "offline", batch system at its heart. It was designed at a time when "online" wasn't a possibility and that is just the way it works.
Technically you could close the batch after each transaction, but you'd pay a batch fee every time to do that, because settlement takes actual work, and it's not how the network was designed to be used. And you still wouldn't receive the money until the next business day at the earliest because of the way ACH works.
This is in contrast to EFTPOS (an "online" debit card transaction in which you type your PIN at a terminal), which involves different technology, different networks, and immediate transfer of funds.
In the US, it is common for debit cards to also be branded with a credit card network like Visa or MasterCard. When you swipe these cards and type in a PIN, it goes through the EFTPOS network (Interlink, Star, Pulse -- you've seen these names on your cards before but probably haven't given them much thought). This is typically advantageous to merchants because fees are lower and the issuing bank is usually liable for fraudulent use (it's all happening online in real time and the user authenticated with a PIN). When you swipe these cards and don't enter your PIN (sometimes signing a receipt), then it goes through the credit card network -- again, a completely different network -- and is part of a nightly batch. The merchant typically pays a higher fee, and if used fraudulently, the merchant usually ends up footing the bill. (The acquirer almost always passes it along to the merchant.) If you've ever wondered why Walmart or your grocery store defaults to the PIN pad and makes you jump through hoops to find the Credit function, that's why -- debit is cheaper for them. And if you've ever wondered why an e-commerce store freaks out when your billing address is wrong, that's why -- if you dispute a transaction as fraudulent, it's them who's paying the bill, no sweat off the bank's back.