What the Muslim should do is refrain from bearing any hatred or resentment in his heart towards his fellow Muslim. Allaah says of His believing slaves (interpretation of the meaning):
“And those who came after them say: Our Lord! Forgive us and our brethren who have preceded us in Faith, and put not in our hearts any hatred against those who have believed. Our Lord! You are indeed full of kindness, Most Merciful”
According to a hadeeth narrated by Anas ibn Maalik (may Allaah be pleased with him), the Prophet (peace and blessings of Allaah be upon him) said: “Do not hate one another, do not envy one another, do not turn your backs on one another, and be, O slaves of Allaah, brothers. It is not permissible for a Muslim to forsake his brother for more than three days.” Narrated by al-Bukhaari, 5718; Muslim, 2559.
Ibn ‘Abd al-Barr said: His saying “Do not hate one another” is a prohibition which is aimed at encouraging them to discipline themselves to love one another. Al-Istidhkaar, 8/289.
However it happens that a person does not get along with certain person and he may feel that he does not like him enough to get close with him. But he fulfils his Islamic duty of returning his salaams, saying “Yarhamuk-Allaah (May Allaah have mercy on you)” if he sneezes, helping him if he needs help, and so on. In this case what exists between them does not come under the heading of forsaking or shunning, and it is forgiven in sha Allaah.
According to a hadeeth narrated by ‘Aa’ishah (may Allaah be pleased with her), the Prophet (peace and blessings of Allaah be upon him) said: “Souls are troops collected together and those who got along with one other (in the realm where souls existed before entering physical bodies in this world) will have an affinity with one another (in this world) and those amongst who did not get along with one another (in the realm where souls existed before entering physical bodies in this world) will also not get along (in this world).” Narrated by al-Bukhaari, 3158; Muslim, 2638.
This refers to the similarity between souls that are good or bad. A good soul will get attracted to the good soul and a bad soul will get attracted to the bad. so people’s souls recognize one another according to their nature, whether good or evil; if they are similar they will get along and if they are different they will not get along.
It is because of the nature of the souls. Souls with similar nature get along. Therefore we see people who get along have same nature and do not get along with differently natured people. some of them get along with one another and some do not, and that depends on the issues which form the basis of getting along or otherwise.
And Allah is all wise.