On your Mac, you can only view the WiFi passwords for networks you have already connected. Moreover, you can only view a WiFi network's password through the System Preferences if you have joined that network.