Why does the app need the location permission to access SSID/BSSID?

Since iOS 13, apps that want to access SSID (Wi-Fi network name) or BSSID (MAC address of the Wi-Fi interface) are required to have the location permission. The reason behind Apple's decision to protect this information by the location permission is that your Wi-Fi network's SSID and BSSID are specific to your location - you usually keep your router at one place.

Any app having access to SSID/BSSID and location can upload this data to a server where this information can be stored in a database. An example of such a database is

https://wigle.net

which contains location information about more than 600 million Wi-Fi networks.

When such databases are publicly available, any app having access to your Wi-Fi network's SSID/BSSID can easily query it and obtain your location. To protect your privacy, access to SSID/BSSID has to be protected by the location permission so apps cannot obtain your location without your permission.