It starts with your friends buying a PS4 copy of the game either through the Playstation Network or a disk-based copy that will come with a registration code they'll enter into the Playstation Network. Then when they start the game, it will have them set up a Square Enix account to link their PSN account to. Once that's done, they can log into their Square-Enix account at the MogStation website to add the Recruit-A-Friend code you sent them. It can be added any time after buying the game and setting up their SE account and before paying their first monthly subscription payment (not counting the initial 30 days that comes with purchase of the game).

You and they will receive the bonus items provided by the Recruit-A-Friend program once they make a monthly payment (so typically 30 days after buying the game, though if they pay with a game-time card, they can do so sooner).