All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Illegitimate children and foundlings - in a Muslim community - are a part of this community. They have the same rights and obligations as others. There is no discrimination on the basis of illegitimacy. They are not charged for the deeds of their parents. Allah Says (what means): {And every soul earns not [blame] except against itself, and no bearer of burdens will bear the burden of another.} [Quran 6:164]
As for the Mahaarim of illegitimate children (unmarriageable relatives) they are their brothers, sisters, their children from mother side only, and maternal uncles, maternal aunts. Only the relatives of the mother are considered, not those of the father, because an illegitimate child does not trace back to his father.
All the relatives who are forbidden from the mother's side include those forbidden through suckling. Allah Says (what means): {…your [milk] mothers who nursed you, your sisters through nursing…} [Quran 4:23]
The Prophet said: "What is made forbidden by reason of blood is made forbidden by reason of the relations based on suckling." [Al-Bukhari and Muslim]
They are entitled to receive all the rights in a Muslim society as others do. The Muslim community and their government are responsible to spend on them, raise them and educate them. During the caliphate of 'Umar, may Allah be pleased with him, a person found a foundling (a small child who may be a son of Zina). 'Umar, may Allah be pleased with him, said: “Take him with you, you have the right of his guardianship and we will spend on him. Another narration reads: “We will bear the expenses of his feeding.”
In a word, the blood relatives from the mother's side, as we mentioned above, are Maharim for illegitimate children, and also all the relatives that become forbidden due to suckling.
These children are eligible to have all rights and obligations as others.
Allah knows best.