While it is not yet confirmed, we may have an idea of how Magearna will tie into everything in "Pokemon Sun and Moon."
During the "Pokemon Sun and Moon" demonstration, just before the battle between the player and Hau, they are met by Professor Kukui and Lillie.
Lillie's bag begins to shake and says the word, "Pew." No doubt there's a Pokemon inside, but which one? Although it is not yet completely positive, there's a big chance that it could be "Pokemon Sun and Moon" Magearna. why? Because of the way Lillie was described on the Pokemon website as well.
Remember, she's said to not be fond of making Pokemon fight in battles. And this ties into how "Pokemon Sun and Moon" Magearna can feel other Pokemon's pain and suffering.
Perhaps Lillie feels this way because of her connection to "Pokemon Sun and Moon" Magearna.
Going one step further, could the reason that Lillie is so mysterious is because she's a descendant of the scientist who created "Pokemon Sun and Moon" Magearna?
Right now, it all just seem to be loosely connected story threads, but there is definitely a high chance that both Lillie and Magearna will be important in some way to the story of "Pokemon Sun and Moon."
It is also important to point out that "Pokemon Sun and Moon" Magearna's Fleur Cannon is likely a Fairy-type move considering it was super effective against Pangoro.
But the Pokemon site confirms something about Pokemon distribution that many people have suspected. Thanks to the new QR Scanner functionality, players merely have to scan the corresponding QR code in order to obtain Magearna for themselves.