AFAIK, there is no way to prevent a user from changing his/her password. It's been discussed (quite long ago) on ocassion on PostgreSQL mailing list, and all the answers I remember were basically "no, you can't".
However, there's a contrib module, called
passwordcheck, whose objective is to guarantee the strength of passwords, if that's what you wish (as already commented by @RDFozz).
From the docs:
passwordcheck module checks users' passwords whenever they are set with
CREATE ROLE or
ALTER ROLE. If a password is considered too weak, it will be rejected and the command will terminate with an error.
To enable this module, add
postgresql.conf, then restart the server.
I've never used the module myself.