How it works, according to Google, is that the Android Location Services periodically checks on your location using GPS, Cell-ID, and Wi-Fi to locate your device. When it does this, your Android phone will send back publicly broadcast Wi-Fi access points' Service set identifier (SSID) and Media Access Control (MAC) data. Again, this isn't just how Google does it; it's how everyone does it. It's Industry practice for location database vendors.
Google tells me that the location checks are made periodically. You don't need to be using Google Maps, Latitude or other geolocation-based application. It just happens.
You can check on this yourself by going to your Android phone and then going to Settings/Location and check Google Location Services or Security/Use Wireless Network off and on. When you check it on you'll get a location consent agreement. This reads: "Allow Google's location service to collect anonymous location data. Collection will occur even when no applications are running."
You don't have to use Google's Wi-Fi location service. You can elect to just use your device's built-in GPS, but the more data points your smartphone has to work with the more accurately it can fix your location and thus make location-based services more accurate and useful. In other words, if you use Wi-Fi on an Android device to help pin your position down though you'll also be contributing to creating Google's maps.
If all that makes you feel a little queasy-what is Apple, Google, and Microsoft doing with this information--well each of them states that they're using the data anonymously. As Google's Director of Public Policy Alan Davidson said in a statement to the Senate judiciary subcommittee on privacy, technology and the law this May:
While location-based services are already showing great value to users, Google recognizes the particular privacy concerns that come with the collection and storage of location information. That's why we don't collect any location information - any at all - through our location services on Android devices unless the user specifically chooses to share this information with Google. We also give users clear notice and control; the set-up process asks users if they would like to "allow Google's location service to collect anonymous location data."
And even after opting in, we give users a way to easily turn off location sharing with Google at any time they wish. The location services in our Android operating system embody the transparency and control principles that we use to guide our privacy process.
In the meantime, if you're really that concerned about the possibility of your phone being tracked, then just don't use Wi-Fi or cellular services on your Android phone, or any other device, to help fix your location. On my Droid 2 phone with Android 2.3, the option to do this is Setting/Location & Security settings/Standalone GPS services.
As for me, I find the advantages of having knowing exactly where I am and where the hotel, restaurant, theater, or what-have you are in relationship to my location to be worth the vanishingly small chance that someone is tracking me with this data.