By default Partner program works for registered customers. Thus, any registered customer is a Partner and has access to Partner program.
The Store owner can also limit the access to Partner program to a certain membership level.
Check the Configuration section for more details.
If a customer came to a store via a Partner link, any orders placed by such a customer are get registered as affiliate orders for corresponding partner account.
The same works for customers that enter partner code on cart page:
Or during the checkout:
If Partner program conditions allows a discount for affiliated orders, it is applied automatically: