All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
In regard to your first question, there is no doubt that it is true that the prayer prohibits immorality and wrongdoing because Allaah informed us about this in His Book. The prayer by which a Muslim achieves this is that which he does as Allaah wishes, fulfilling humbleness and submissiveness in prayer, and thinking about the greatness of Allaah. It is such a prayer that yields the fruits of piety, and prevents the person from committing illicit and immoral acts.
As regards your second question, you were wrong to inform your husband about what you have committed. You should have repented to Allaah and concealed your sin. For more benefit, please refer to Fataawa 86527 and 84052.
What your husband is feeling is due to you committing that sin and a result of you not concealing it.
Therefore, your husband should see in you a good conduct and you should be keen on wearing Hijab, staying away from mixing with men and avoiding doubtful circumstances, and other things which may help him feel reassured and confident about you.
Allaah Knows best.