Praise be to Allah.
It is proven that the Prophet (blessings and peace of Allah be upon him) said: “Any woman who puts on perfume and passes by people so that they can smell her fragrance is a zaaniyah.”
Narrated by Imam Ahmad (19212) and al-Nasaa’i (5126); classed as hasan by al-Albaani in Saheeh al-Jaami‘.
With regard to men, they are not forbidden to do that; rather it is mustahabb for men to use perfume on all occasions, and it is particularly mustahabb on Fridays and Eid, when people gather in mosques and prayer-places and so on. The Prophet (blessings and peace of Allah be upon him) loved perfume and used it. The Messenger of Allah (blessings and peace of Allah be upon him) said: “Women and perfume have been made dear to me and my delight is in prayer.” Narrated by Ahmad (11885), al-Nasaa’i (3940); classed as saheeh by al-Albaani.
The difference between women and men is that the basic principle with regard to woman is that she should stay in her house and use her adornment there, so that no temptation will be caused by her and she will not encounter any negative consequences. In the case of men, the man goes out of his house and works, and travels about, and mixes with people in gatherings, marketplaces and so on.
Moreover the temptation of men by women is greater than the temptation of women by men; if a man is attracted by a woman he can pursue her and try to tempt her; but a woman is usually pursued and is not the pursuer. If it so happens that she is attracted to a man, she would not pursue him, because the shyness and chastity that are part of her inherent nature usually prevent her from pursuing him. Moreover, if she stays in her house and does not go out often and mix with man, that prevents this fitnah or prevents her acting upon it.
For more information please see the answer to question no. 102329 and 7850
With regard to praying with perfume on, if she does that in her house there is nothing wrong with her doing that.
But if she is outside her house, it is not permissible for her to put on perfume, whether she is going to the mosque or anywhere else; rather it is narrated that women are specifically forbidden to use perfume when going to the mosque.
It was narrated that Zaynab, the wife of ‘Abd-Allah ibn Mas‘ood (may Allah be pleased with her and her husband) said: The Messenger of Allah (blessings and peace of Allah be upon him) said to us: “If one of you (women) wants to go to the mosque, let her not put on perfume.”
Narrated by Muslim (443).
What the Muslim woman should do, if she wants to go to the mosque, is to go out wearing her hijab, not wearing adornment or anything like perfume or anything else that may attract attention or cause fitnah.
It was narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “Do not prevent the female servants of Allah from going to the mosques of Allah, but let them go out looking scruffy.”
Narrated by Ahmad (9362) and Abu Dawood (565).
Ibn Daqeeq al-Eid (may Allah have mercy on him) said:
Also included with perfume is whatever comes under the same heading; perfume is only forbidden because it may provoke men’s desires, and it may also provoke a woman's desire too [i.e., if she uses perfume, her desire may be stirred up]. Whatever could cause a similar effect is also forbidden. It is narrated in a saheeh report that the Prophet (blessings and peace of Allah be upon him) said: “Any woman who scents herself with bukhoor (incense) should not attend ‘Isha’ prayer with us.” To that may be added beautiful clothes and wearing jewellery that can be seen. Some of them interpreted the words of ‘Aa’ishah (may Allah be pleased with her) in al-Saheeh - “If the Messenger of Allah (blessings and peace of Allah be upon him) could see what women have introduced after he died, he would have forbidden them to go to the mosques, as the women of the Children of Israel were forbidden” -- as referring to this, i.e., the introduction of beautiful clothing, perfume and adornment. End quote.
Ihkaam al-Ahkaam Sharh ‘Umdat al-Ahkaam, 1/196. See also: ‘Awn al-Ma‘bood Sharh Sunan Abi Dawood.
For more information, the answer to question no. 21970.
And Allah knows best.