Here's the step-by-step tutorial to share Wi-Fi password from  iPhone to other phones.

First of all, both devices must have the latest version of iOS, iPadOS or macOS.

If one wants to share their Wi-Fi password with others, ensure that they are in the contact list.

Both devices should have Wi-Fi & Bluetooth turned on &  Personal Hotspot off.

Do make sure that the email address (used in Apple ID) is saved in the other phone's contacts.

The phone you are sharing your password with must have their email address saved in your contacts.

Make sure that your device is  unlocked & connected to  the Wi-Fi network.

Keep the other device nearby, within Bluetooth & Wi-Fi range.

Select the Wi-Fi network on the Apple device  you want to connect.

Now on the iPhone, tap Share Password, then tap Done.