Typically you register the domain name (e.g. www.example.foo) at the same time that you pay for web hosting. It may be of some use to you to think about the important question of what to name your website - and the legal limits that may be set by existing websites with similar names.
Brainstorm a few possible domain names for your website. Use Google to check to see if these domain names are available. Remember that the best domain names are memorable, short, and do not require the user to remember idiosyncratic spellings or usages of valid punctuation marks like the underscore. Also remember that you will want your domain to be unique - if your proposed domain name is www.examplewebsite.net and there are already websites named www.examplewebsite.com, www.theexamplewebsite.net, www.example_website.foo, or other similar permutations, you should consider seeking an alternative name. When you register your domain name for business or personal branding, consider registering all similar domain names to prevent brand dilution. Once you've determined an available and acceptable domain name you would like to use, make sure that it makes sense for your website's title. You may need to change your title to reflect the available domain names.