Praise be to Allah.
All people have the custom of greeting one another, and every group has its own distinctive greeting that distinguishes them from other people.
The Arabs used to greet one another with the words Anim sabaahan or Animu sabaahan
[equivalent to Good morning Translator], using words derived from al-nimah, which means good living after the morning. The idea was that because the morning is the first part of the day, if a person encounters something good in the morning, the rest of the day will be good too.
When Islam came, Allaah prescribed that the manner of greeting among Muslims should be Al-salaamu alaykum, and that this greeting should only be used among Muslims and not for other nations. The meaning of salaam
(literally, peace) is harmlessness, safety and protection from evil and from faults. The name al-Salaam is a Name of Allaah, may He be exalted, so the meaning of the greeting of salaam which is required among Muslims is, May the blessing of His Name descend upon you. The usage of the preposition ala in alaykum (upon you) indicates that the greeting is inclusive.
Ibn al-Qayyim said in Badaai' al-Fawaaid (144):
Allaah, the Sovereign, the Most Holy, the Peace, prescribed that the greeting among the people of Islam should be al-salaamu alaykum, which is better than all the greetings of other nations which include impossible ideas or lies, such as saying, May you live for a thousand years, or things that are not accurate, such as Anim sabaahan (Good morning), or actions that are not right, such as prostrating in greeting. Thus the greeting of salaam is better than all of these, because it has the meaning of safety which is life, without which nothing else can be achieved. So this takes precedence over all other aims or objectives. A person has two main aims in life: to keep himself safe from evil, and to get something good. Keeping safe from evil takes precedence over getting something good
The Prophet (peace and blessings of Allaah be upon him) made spreading salaam a part of faith. Al-Bukhaari (12, 28 and 6236), Muslim (39), Ahmad (2/169), Abu Dawood (5494), al-Nisaai, (8/107) and Ibn Hibbaan (505) narrated from Abd-Allaah ibn Umar that a man asked the Messenger of Allaah (peace and blessings of Allaah be upon him): What is the best thing in Islam? , He said: Feeding others and giving the greeting of salaam to those whom you know and those whom you do not know.
Ibn Hajar said in al-Fath (1/56):
i.e., do not single out anybody out of arrogance or to impress them, but do it to honour the symbols of Islam and to foster Islamic brotherhood.
Ibn Rajab said in al-Fath (1/43):
The hadeeth makes the connection between feeding others and spreading salaam because this combines good actions in both word and deed, which is perfect good treatment (ihsaan). Indeed, this is the best thing that you can do in Islam after the obligatory duties.
Al-Sanoosi said in Ikmaal al-Muallim (1/244):
What is meant by salaam is the greeting between people, which sows seeds of love and friendship in their hearts, as does giving food. There may be some weakness in the heart of one of them, which is dispelled when he is greeted, or there may be some hostility, which is turned to friendship by the greeting.
Al-Qaadi said in Ikmaal al-Muallim (1:276):
Here the Prophet (peace and blessings of Allaah be upon him) was urging the believers to soften their hearts. The best Islamic attitude is to love one another and greet one another, and this is achieved by words and deeds. The Prophet (peace and blessings of Allaah be upon him) urged the Muslims to foster love between one another by exchanging gifts and food, and by spreading salaam, and he forbade the opposite, namely forsaking one another, turning away from one another, spying on one another, seeking out information about one another, stirring up trouble and being two faced.
Love is one of the duties of Islam and one of the pillars of the Islamic system. One should give salaams to those whom one knows and those whom one does not know, out of sincerity towards Allaah; one should not try to impress other people by giving salaams only to those whom one knows and no-one else. This also entails an attitude of humility and spreading the symbols of this ummah through the word of salaam.
Thus the Prophet (peace and blessings of Allaah be upon him) explained that this salaam spreads love and brotherhood. Muslim (54), Ahmad (2/391), and al-Tirmidhi (2513) narrated from Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said:
You will not enter Paradise until you believe, and you will not believe until you love one another. Shall I not tell you about something which, if you do it, you will love one another? Spread salaam amongst yourselves.
Al-Qaadi Ayaad said in al-Ikmaal (1/304):
This is urging us to spread salaam, as mentioned above, among those whom we know and those whom we do not know. Salaam is the first level of righteousness and the first quality of brotherhood, and it is the key to creating love. By spreading salaam the Muslims love for one another grows stronger and they demonstrate their distinctive symbols and spread a feeling of security amongst themselves. This is the meaning of Islam.
The Prophet (peace and blessings of Allaah be upon him) also explained the reward earned by the one who says salaam, as was reported by al-Nisaai in Aml al-yawm wal-laylah (368) and al-Bukhaari in al-Adab al-Mufrad (586) and by Ibn Hibban (493). They reported from Abu Hurayrah (may Allaah be pleased with him) that a man passed by the Messenger of Allaah (peace and blessings of Allaah be upon him) whilst he was sitting with some others, and said Salaam alaykum (peace be upon you). The Prophet (peace and blessings of Allaah be upon him) said, [He will have] ten hasanaat (rewards). Another man passed by and said Salaam alaykum wa rahmat-Allaah (peace be upon you and the mercy of Allaah). The Prophet (peace and blessings of Allaah be upon him) said, [He will have] twenty hasanaat. Another man passed by and said Salaam alaykum wa rahmat-Allaahi wa barakaatuhu (peace be upon you and the mercy of Allaah and His blessings). The Prophet (peace and blessings of Allaah be upon him) said, [He will have] thirty hasanaat.
The Prophet (peace and blessings of Allaah be upon him) commanded us to return salaams, and made it a right and a duty. Ahmad (2/540), al-Bukhaari (1240), Muslim (2792), al-Nisaai in al-Yawm wal-Laylah (221) and Abu Dawood (5031) all reported that Abu Hurayrah (may Allaah be pleased with him) said that the Prophet (peace and blessings of Allaah be upon him) said: The Muslim has five rights over his fellow-Muslim: he should return his salaams, visit him when he is sick, attend his funeral, accept his invitation, and pray for mercy for him [say Yarhamuk Allaah] when he sneezes.
It is clear that it is obligatory to say salaam and return salaams, because by doing so a Muslim is giving you safety and you have to give him safety in return. It is as if he is saying to you, I am giving you safety and security, so you have to give him the same, so that he does not get suspicious or think that the one to whom he has given salaam is betraying him or ignoring him. The Prophet (peace and blessings of Allaah be upon him) told us that if Muslims are ignoring or forsaking one another, this will be put to an end when one of them gives salaam. Al-Bukhaari (6233) reported that Abu Ayyoob (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: It is not permissible for a Muslim to forsake his brother for more than three days, each of them turning away from the other if they meet. The better of them is the first one to say salaam.
This is a brief overview of the importance of giving and returning salaam.