In order to battle with people from all over you must first connect using wi-fi, obviously. Use this guide to learn how to do so, if you don't already know. And if you do and are having trouble then perhaps I might be able to help with troubleshooting.
First, when the menu comes up it'll say Continue, New Game, Mystery Gift(some people), and Nintendo WFC Settings. Go to the settings. Now it'll tell you to tap a selection. Again the settings one, not the options one. Three boxes will appear that say connection 1, 2 and 3. Tap where it says "None" and a new screen will appear, Now tap Search For an Access Point. It will search and when it comes up tap on the first or the strongest connection. It will test it and now its almost complete.
Next step takes place in the game. Go to the bottom floor of any Pokemon Center and talk to either of the two ladies close to each other(the other one near the PC doesn't do much). They will guide you with the last few steps. Any questions, feel free to ask. I tried my best to make it as detailed as possible without it being too confusing.
There is also a way to connect using a cable, but I have no knowledge in using said cable. So you might wanna ask someone who does. Hope this helps though! :]