How do I dynamically change the $GLOBAL['base_path'] variable?
I don't think base path is what you need here.
Once the user's page is loading it is too late to change their URL, unless you redirect them them to the /members or /guests url with drupal_goto().

Base path is also not what you need because base path is telling drupal where your files are in the web root, so changing the $base_path global is likely just going to break your site unless your files are in /var/www/yoursite/members and /var/www/yoursite/guests (I'm assuming your web server setup here for the paths).

The main thing here is that you need to make sure your users are actually hitting the paths www.example.com/members/path and www.example.com/guests/path and then you have to make drupal handle those paths appropriately or you will just get page not found errors.

This is how the drupal multilingual (locale) system works.
It rewrites urls that appear on the page to point to www.example.com/langcode/path so the user is actually navigating to those pages. If there is no langcode part drupal just assumes the default language.

In drupal 6 this is ingrained into the url() function, which calls language_url_rewrite().
In drupal 7 the local module has an implementation of hook_url_outbound_ater() (local_url_outbound_alter()).

You could replicate this by implementing custom_url_rewrite_outbound() (read the docs for that, it is not a normal hook).
Or use the url alter module and implement its hook_url_outbound_alter() hook.

That's not all though, because users are going to paths like www.example.com/langcode/path those paths have to be valid drupal menu system paths or else drupal won't know that functions to call for that given page.

For the multilingual system drupal core handles this in the bootstrap phase, before any menu handling has happened.

See _drupal_bootstrap(), which for the DRUPAL_BOOTSTRAP_LANGUAGE phase calls drupal_init_language(), which in turn calls language_initialize().

language_initialize() has code in it that detects the language from the url and then removes that language portion of the url from the $_GET['q'] variable so everything from then on just sees www.example.com/path and the page loads as normal.

If you were to use this same approach for your path then the system would try to load the menu item for www.example.com/members/path and it would likely not exist and you would get page not found errors.

However you could the also add an implementation of hook_boot() that does something similar to language_initialize() and save a global variable of your user type (member or guest) and then removes that part of the url from $_GET['q'] before the menu handler runs.

From then the $_GET['q'] variable doesn't have your user type anymore but you will be able to use the user type global you created from your other custom code if you need to.

This system relies on there being a default user type for when guests or members are not present (which can easily happen, for example the user can just type in the url manually instead of clicking one of your altered links).

So your system would have to assume the user type or work it out in some other way (easy because you have user_is_logged_in() or global $user to determine the user type). It just means in these cases the user doesn't get to see that url scheme you want with the user type in it.

As you can see this is a complex requirement and the solution doesn't have 100% coverage so i it was me I would reconsider doing this at all.

Alternatively you may be able to just have a members area, full of pages like views and nodes that do really have urls like /members/something, but not change the url for the whole site (although I'm just making assumptions on your requirements now).