First you must turn on Wi-Fi on the Torch 9800 and set it up to connect to your Wi-Fi router.
Then you must go to the Mobile Network Options to turn on Data Services. Yes, you must turn on Data Services for Mobile Network to use Wi-Fi, even if you do not have a BlackBerry data plan. Then the 9800 will actually use the Wi-Fi and you can use the browser to browse the web.
I was field testing my BB Torch 9800 and I had already connected it to my wireless router and successfully browsed the web with it. At a later stage I wanted to check something with the browser and it just kept giving me an error saying "Unable to connect to the Internet, please try again later".
It took me five hours of searching the Internet and messing around with the 9800 until I accidentally discovered that you must turn on Data Services for Wi-Fi to work. The Wi-Fi section of the "BlackBerry Torch 9800 Smartphone User Guide" says nothing about turning on Data Services for Mobile Network. It just never occurred to me that they were related since my previous Pocket PC was quite happy to use Wi-Fi without any Data Services.
I have not tested whether if I had a data service AND Wi-Fi whether it would connect via data over the Wi-Fi.
This might also apply to other BlackBerry devices. I do not know because this is my first BlackBerry device.