There is a QR scanner available in the Pokémon Sun and Moon games, which allow you to scan these and add the Pokémons to your Pokédex. You will not fully unlock it, but scanning them will show you where you can capture them.
As an added bonus, once you scan 10 QR codes, a special Pokémon will appear somewhere close to where you are playing. These special Pokémon can be caught and used just like any other, and includes starter Pokémon from previous games, and another cool Pokémon that cannot be obtained any other way.
To get the QR codes you can scan it from a friend's game, or do it the easy way; just follow this link to an image gallery with every single Pokémon QR code available! Now just open the QR code scanner in-game and start scanning right away.