By default, Refer a Friend plugin will generate referral links for every new user that registers with your site, whereas for already registered users it will be generated as soon as they view any page where their referral link is showing.
But, if you need to generate it at once for all your past customers – in case you want to send an email with a referral link to all your customers – just go to WooCommerce -> Status -> Tools and click on the “Create Referrals” button.
Before this, make sure the option to hide referral links for users without orders is turned off, under general plugin settings.