I needed to share a Wi-Fi password for a network my iPhone regularly connects to, but I was not near at the time. This is with iOS 16.5, I’m not sure what versions this will work with. On the iPhone go into settings, then select Wi-Fi.
The default view shows what you are connected to and the nearby networks. Hit the Edit button at the top right of the screen to see stored networks instead of what’s nearby.
Select the network you want to examine.
Hit the hidden password item. (the dots)
It should prompt you for access. My phone used facial recognition. Then it will show you the password and let you copy it.