Praise be to Allah.
The believer should think positively of his fellow Muslim and should assume the best, and interpret his affairs in a good way, and he should keep away from suspicion and negative thinking for which there is no basis, because Allah, may He be exalted, says (interpretation of the meaning): “O you who believe! Avoid much suspicions, indeed some suspicions are sins. And spy not…” [al-Hujuraat 49:12].
It says in Zawaajir ‘an Iqtiraaf al-Kabaa’ir (2/226): This verse indicates that it is emphatically prohibited to enquire into the private affairs of people and seek out their faults. The Prophet (blessings and peace of Allah be upon him) said: “Do not spy on one another, do not compete with one another, do not envy one another, do not hate one another, do not turn your backs with one another, and be, O slaves of Allah, brothers as He has commanded you.” And he (blessings and peace of Allah be upon him) said: “O you who have paid lip service to faith but faith has not entered your hearts: do not backbite about the Muslims or seek out their faults, for whoever seeks out the faults of the Muslims, Allah will seek out his faults, and if Allah seeks out a person’s faults, He will expose him even if he is in the innermost part of his house.” It was said to Ibn Mas‘ood (may Allah be pleased with him): What do you think if I tell you about al-Waleed ibn ‘Utbah and wine dripping from his beard? He said: We were forbidden to spy on one another; if he shows us anything amiss in his conduct, then we will take him to task for it. End quote.
Based on that, the basic principle is that it is not permissible for a husband under ordinary circumstances to ask his wife for the password to her cell phone or computer, because this conduct implies doubt and suspicion, and it may sour the relationship between the spouses in a manner that may be difficult to put right.
But if the husband has found indications or circumstantial evidence that points to his wife doing some things that are contrary to Islamic teaching, then there is no reason why he should not ask her for her password. In fact in that case he has the right to use trickery – without her knowledge – to find out about what is really going on. We have previously quoted a fatwa of Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) concerning this issue. Please see fatwa no. 13318.
For more information, please see also the answer to question no. 145815
And Allah knows best.