To connect to WiFi, you must have one of two things:
1. You must have a wireless internet. Having this, all you have to do is go here: http://www.nintendowifi.com/consumerservice/routerSetup.do, find your router, and make the appropriate setting changes.
...or...
2. You must purchase the Nintendo WiFi USB Connector. This will enable your DS to still connect to WiFi without the need for a wireless network if you don't already have one and don't want one. Simply install the software and the device will "piggy-back" with your computer's connection.
Either method above will get you connected to WiFi.