Security researchers have discovered the logging mechanism and have found logs going back almost an entire year on some phones. They point out it seems to have been introduced in iOS 4, which was launched in the summer of 2010 concurrently with the iPhone 4. If you have an older iPhone that isn't eligible for the iOS 4 upgrade, you shouldn't have anything to worry about.
They also found out the data doesn't just stay on the phone. When you dock your phone with iTunes and back it up, the log is backed up with everything else. That means anyone that has access to a computer you've docked with can trace your steps back to when you first got iOS 4. If you get a new phone and restore your old settings to the new device, the log goes on the new phone and begins growing again once the new device is in service.
It appeared to be an iOS-only issue at first, but research by security analyst Samy Kamkar reportedly has identified an HTC Android phone that transmits location data to Google.
GPS is an amazing technology. It is more convenient than a paper map and can also be credited with saving lives when emergency responders zero in on someone's location--with the help of a carrier--in the event of an accident or other mishap. Like everything else in technology though, the good can be tainted with bad as we risk giving up freedoms.
The issue is large enough that Senator Al Franken has sent a letter to Apple demanding the answers to nine questions. He prefaces the letter stating that the "existence of this information--stored in unencrypted format--raises serious privacy concerns." If the data falls into the wrong hands, he notes, the location of your physician, the school your kids attend, any trips that have been taken and their home could easily be determined.
To protect your data, you should consider encrypting your hard drive. That way if someone does get your machine, unless they have your login or encryption key, the data should be inaccessible. The only thing you can do on the phone is make sure that it locks with PIN code.
Is your privacy worth giving up to some degree for the convenience and utility of the iPhone? We give up freedoms everyday for convenience. The use of debit and credit cards effectively tracks our movements and spending habits. Devices for our cars that pay the toll roads as we move through the gate at 60 miles per hour also track where we have gone. Now, we cannot even walk the dog without Apple's crown jewel tracking our every step.