What is the global $wp object used for?

It contains the main instance of the WP class, which is primarily responsible for parsing the request URL and querying the appropriate posts, as well as sending headers and handling 404s. It can be used for things like getting the current request URL.

If it’s declared in a function but not used, it’s likely a mistake, or left over from a previous version of the function that did use it. You would need to ask the plugin developer why.