What authentication is being used in SharePoint? If it is Windows Authentication then it is not possible to get the password, as the password hash will be stored in Active Directory. There is no way to get the password.
However, you can validate if the user/password combination is correct.
Use the
System.DirectoryServices.AccountManagement
namespace to query the AD
Check this post on how to do it. link