Pokemon Sun and Moon QR codes allow you to scan codes of every Pokemon and add them to your Pokedex. You first need to know how to scan and use them.
Each QR codes corresponds to one Pokemon in the Pokedex. Using these codes you can get the location of respective pokemon in your map,
To scan the QR code, open the menu and head to the second page, select the QR Scanner option. Place the QR code in front of it and snap, when the camera is activated. Then it will be added to your Pokedex, revealing where you can catch it. You can only scan 10 times a day and you will get 10 points for each scan.
It allows you to scan the entire island for alolan pokemon. Every 100 points allow you to use the Island scan pokemon. Island Scan reveals the non-alolan Pokemon for a limited time. Once you made a scan, you will find the nearest Alolan Pokemon and the location is visible only for an hour.
With the new Island Scan Pokemon available every day on each island, you can continue to scan QR codes and over the coming days, it will take you over a month to scan each and every non-alolan pokemon.
This is how the QR code and scanner works. If you have any doubts or queries, put them in the comment section.