Many websites enforce registration before they can be used. Sometimes only limited access is available to unregistered users. If users want to use all the functionality of the site, then they have to register and provide their email addresses.
In the past, some websites used to sell the email addresses of their users. Now, most reputable sites publish email policies allowing users to opt out of any email marketing. If a user registers for a website, they should ensure that they read the policy thoroughly and choose the appropriate response on the sign-up form of the website.
Some websites state that their policy is not to sell or give out user's email addresses, but marketing information from other companies is still received. The email is sent from the website on behalf of the third party, and so the policy is not being broken. The only consolation is that the marketing emails received are usually inoffensive and even possibly of interest.