Praise be to Allah
The Eids of the Muslims have not been prescribed only for the purpose of joy, fun and visiting one another; rather they are among the symbols and acts of worship of the religion, so the Sunnah on these occasions is for the Muslims to celebrate them openly and proclaim them.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
The Eids are among the most specific distinguishing features of different religions, and among the most obvious of their rituals.
End quote from Iqtida’ as-Siraat al-Mustaqeem (1/528)
Hence you will find that every religion has its own festivals that its followers care about and celebrate openly, because they are an important part of their religion.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
Expressing joy on the occasion of the Eids is one of the symbols of the religion.
End quote from Fath al-Baari (2/443)
So expressing joy on Eid is one of the acts of worship by which the Muslim draws closer to Allah.
Ahmad (24334) narrated that ‘Aa’ishah (may Allah be pleased with her) said: The Messenger of Allah (blessings and peace of Allah be upon him) said on that day – i.e., the day on which the Ethiopians played in the mosque: “Let the Jews know that in our religion there is lenience. Verily I have been sent with an easygoing religion.”
Classed as saheeh by al-Albaani in Saheeh al-Jaami‘ (3219).
Moreover, there is no contradiction between expressing joy on Eid and feeling sorrow for what has befallen the Muslims and grieving for their situation. The Muslim expresses his joy on Eid in order to show his religious commitment openly and to show his support for his religion and at the same time he shares the sorrows of the Muslims.
So the Muslim should combine both matters: he should practice the rituals and acts of worship of Islam openly, such as the Eid prayer, and he should express some measure of joy and happiness. And at the same time he should feel sorrow for what has befallen his brethren, and he should feel their pain.
Undoubtedly the more the Muslim feels the pain and anguish of his Muslim brothers, the less he will indulge in permissible kinds of entertainment and play, even if he allows himself expressions of joy on Eid and gratitude for the blessings that Allah has bestowed upon him.
See the answer to question no. 21284 for more information on what we must do with regard to the slaughter of Muslims around the world.
See the answer to question no. 7837 for information on how to console our brethren who are stricken by calamity.
And Allah knows best.