Apple has come under heavy scrutiny lately over their iPhone and iPad tracing peoples locations. The iPhone and iPad were both saving your location to a database within the phone; saving information like GPS location and hotspots.
Apple confirmed that the company is not tracking your location, has never done so, or ever plans to. The database is simply to make finding your location faster and more accurate (Apple Announcement),
Why is my iPhone logging my location?
The iPhone is not logging your location. Rather, it's maintaining a database of Wi-Fi hotspots and cell towers around your current location, some of which may be located more than one hundred miles away from your iPhone, to help your iPhone rapidly and accurately calculate its location when requested. Calculating a phone's location using just GPS satellite data can take up to several minutes. iPhone can reduce this time to just a few seconds by using Wi-Fi hotspot and cell tower data to quickly find GPS satellites, and even triangulate its location using just Wi-Fi hotspot and cell tower data when GPS is not available (such as indoors or in basements). These calculations are performed live on the iPhone using a crowd-sourced database of Wi-Fi hotspot and cell tower data that is generated by tens of millions of iPhones sending the geo-tagged locations of nearby Wi-Fi hotspots and cell towers in an anonymous and encrypted form to Apple.
According to Macrumors.com, Apple was only receiving anonymous data that was encrypted and doesn't link back to your identity.
Apple is already working on an update for iPhones which is expected to release in the coming weeks that will address the location issues. The iOS update will reduce the amount of WiFi hotspots and cell towers recorded to the phone and will delete the location cache completely when location services are disabled.