Praise be to Allaah.
Allaah has commanded us to spread the greeting of salaam, and has enjoined us to return the greeting to all Muslims. He has made the greeting of salaam one of the things that spread love among the believers.
Allaah says (interpretation of the meaning):
" When you are greeted with a greeting, greet in return with what is better than it, or (at least) return it equally. Certainly, Allaah is Ever a Careful Account Taker of all things "
And it was narrated that Abu Hurayrah said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: "You will not enter Paradise until you (truly) believe, and you will not (truly) believe until you love one another. Shall I not tell you something which, if you do it, you will love one another? Spread the greeting of salaam amongst yourselves."
Narrated by Muslim, 54.
In the answer to question no. 4596, there is a lengthy discussion on the importance of greeting with salaam and returning the greeting.
The command to spread the greeting of salaam is general and applies to all the believers. It includes men greeting men and women greeting women, and a man greeting his female mahrams. All of them are enjoined to initiate the greeting of salaam, and the other is obliged to return the greeting.
But there is a special ruling that applies to a man greeting a non-mahram woman, because of the fitnah (temptation) that may result from that in some cases.
There is nothing wrong with a man greeting a non-mahram woman with salaam, without shaking hands with her, if she is elderly, but he should not greet a young woman with salaams when there is no guarantee that there will be no fitnah (temptation). This is what is indicated by the comments of the scholars, may Allaah have mercy on them.
Imam Maalik was asked: Can a woman be greeted with salaam? He said: With regard to the elderly woman, I do not regard that as makrooh, but with regard to the young woman, I do not like that.
Al-Zarqaani explained the reason why Maalik did not like that, in his commentary on al-Muwatta': Because of the fear of fitnah when he hears her returning the greeting.
In al-Adaab al-Shar'iyyah (1/370) it says: Ibn Muflih mentioned that Ibn Mansoor said to Imam Ahmad: (What about) greeting women with salaam? He said: If the woman is old there is nothing wrong with it.
Saalih (the son of Imam Ahmad) said: I asked my father about greeting women with salaam. He said: With regard to old women, there is nothing wrong with it, but with regard to young women, they should not be prompted to speak by being made to return the salaam.
Al-Nawawi said in his book al-Adhkaar (p. 407):
Our companions said: Women greeting women is like men greeting to men. But when it comes to women greeting men, if the woman is the man's wife, or his concubine, or one of his mahrams, then it is like him speaking to another man; it is mustahabb for either of them to initiate the greeting of salaam and the other is obliged to return the greeting. But if the woman is a stranger (non-mahram), if she is beautiful and there is the fear that he may be tempted by her, then the man should not greet her with salaam, and if he does then it is not permissible for her to reply; she should not initiate the greeting of salaam either, and if she does, she does not deserve a response. If he responds then this is makrooh.
If she is an old woman and he will not be tempted by her, then it is permissible for her to greet the man with salaam and for the man to return her salaams.
If there is a group of women then a man may greet them with salaam, or if there is a group of men, they may greet a woman with salaam, so long as there there is no fear that any of the parties may be tempted.
Abu Dawood (5204) narrated that Asma' the daughter of Yazeed said: "The Prophet (peace and blessings of Allaah be upon him) passed by us woman and greeted us with salaam." Classed as saheeh by al-Albaani in Saheeh Abi Dawood.
And al-Bukhaari (6248) narrated that Sahl ibn Sa'd said: "There was an old woman of our acquaintance who would send someone to Budaa'ah (a garden of date-palms in Madeenah). She would take the roots of silq (a kind of vegetable) and put them in a cooking pot with some powdered barley. After we had prayed Jumu'ah, we would go and greet her, then she should offer (that food) to us."
Al-Haafiz said in al-Fath:
Concerning the permissibility of men greeting women with salaam and women greeting men: what is meant by its being permitted is when there is no fear of fitnah.
Al-Haleemi was quoted as saying: Because the Prophet (peace and blessings of Allaah be upon him) was infallible and protected from fitnah. Whoever is confident that he will be safe from temptation may greet (women) with salaam, otherwise it is safer to keep silent.
And al-Muhallab is quoted as saying: It is permissible for men to greet women with salaam and for women to greet men, if there is no fear of fitnah.
And Allaah knows best.
See Ahkaam al-'Awrah wa'l-Nazar by Musaa'id ibn Qaasim al-Faalih.