According to Nintendo, this is a generic issue.
I'll compile some fixes for you:
1) Make sure that any other interfering devices, such as microwaves and cordless phones, are turned off.
2) Make sure that the Nintendo 3DS is within 30 feet of the wireless access
point and facing in its general direction.
3) You might have a MAC filter in your wifi, try to connect from a pc/phone/tablet etc that didn't connect before.
If you aren't using a home wifi and a public one, like hotel wifi:
4) Ensure the Hotspot location does not require an internet browser to setup an account, accept a use agreement, or enter a password before accessing their Wi-Fi service. If the location requires any of these items, you will not be able to connect to the Internet with your Nintendo 3DS.
Nintendo states that if these don't work, you should call 1-800-895-1672 and ask for help from them for your specific case.