Looking to do this in Drupal 7? See my updated post on how to Create a user account in Drupal 7 programmatically.
There have been a few situations in which I needed to create a user on a Drupal site based on some action. There are many other situations where this might be necessary so I put together a really quick example of how it can work. The code I have below is based heavily on the Ubercart code that creates new users when they purchase a product on an Ubercart powered Drupal site.