This Surah was revealed at Makkah during the early stages when the Prophet was enduring extremely difficult conditions.
Allah has made Muhammad's name everlasting
The disbelieving Qureysh used to say: "Muhammad (pbuh) is cut off from his community and reduced to a powerless and helpless individual. Muhammad bin Ishaq says: "Whenever the Prophet (pbuh) was mentioned before As bin Wa'il , the chief of Makkah, he used to say: Leave him alone for he is only a childless man (abtar) with no male offspring. When he dies, there will be no one to remember him." (Reported by Ibn Jarir). Ibn Sa'ad and lbn Asakir have related that Sayyiduna Abdullah bin 'Abbas said; "The eldest son of the Prophet (pbuh) was Qasim; next to him was Zainab, next to her Sayyiduna Abdullah and next to him three daughters; Umme Kulthum, Fatimah and Ruqayyah. Of them first Sayyiduna Qasim died and then Sayyiduna Abdullah. Thereupon As bin Wa'il said: "His line has come to an end; now he is abtar (i. e. cut off from the root)." Abu Jahl also had said similar words on the death of the Prophet's son, Abdullah.
Such were the disturbing conditions under which Surah Al-Kauthar was sent down. The Qureysh were angry with him because he worshipped and served only Allah and repudiated their idolatry publicly. For this very reason, he was deprived of the rank, esteem and honor that he enjoyed among his people before Prophethood and was now cut off from his community. The handful of his Companions were helpless, poor people who were also being persecuted and tyrannized. The Prophet (pbuh) was grieved by the death of his two sons, one after the other, whereas the near relatives and the people of his clan were rejoicing and uttering such words which were disheartening and disturbing for a noble person who had treated even his enemies most kindly. At this, Allah in just one sentence of this brief Surah, gave him the good news - better news than which has never been given to any man in the world. It will be his opponents who will be cut off from their roots and not him.