They allow you to play over Wi-fi, because Pokemon games fit the "family friendly" idea by not allowing you to play wifi with random people, so you require these twelve digit codes, which both the person initiating wireless contact and the person receiving wireless contact must have.
Basically, to play Tails, I would need his code, and he would need mine.