Apple iOS 17 and earlier
- In the Settings app, tap Wi-Fi.
- Find the Wi-Fi network that you’re currently using.
- Tap the info button to the right of your Wi-Fi Router Name (blue icon with lowercase " i " surrounded by a blue circle) 
- Tap the Password field.
- Use your passcode, Face ID, or Touch ID to unlock and reveal the password.
Apple iOS 18 and later
- Go to the Passwords app on your iPhone.
- Tap Wi-Fi.
- If you’re connected to a Wi-Fi network, its name appears at the top of the screen. You can also see all the Wi-Fi networks you’ve previously saved.
- If you don’t see your Wi-Fi, tap Passwords to go to the Passwords Home Screen.
- Tap your Wi-Fi network.
- Tap the Password field. To copy the password to use elsewhere, tap Copy.
Android OS
- Open your device's Settings app.
- Tap Network and Internet >> Internet.
- Tap your Wi-Fi network >> Share.
- Your device will give you a QR code. To join the same network, have your friend scan the code with another device.
Sources
iOS: Find your saved Wi-Fi passwords on iPhone or iPad - Apple Support
Android: Connect to Wi-Fi networks on your Android device - Android Help (google.com)