An actual connection is not necessary for wifi to contribute to location accuracy. It just uses signal strength to available access points to triangulate. How folks like Google/Apple/etc. are able to get accurate location data for those access points is unknown to me.
TLDR Android & iOS Location Services will automatically contribute wifi data and correlate it with GPS. This can be audited to prove it's anonymously uploaded but it does happen.