The situation of one who is illegitimate and the ruling on marrying him
Question

                Is it true that our beloved prophet (peace and blessings of Allaah be upon him) has strongly forbidden to marry iligitimate person eventhough this person is very pious?
Praise be to Allah.
    There are some ahaadeeth that condemn the illegitimate child, 
    but most of these ahaadeeth are da’eef (weak) and are not saheeh (sound). It 
    was narrated by Abu Dawood in his Sunan (4/39) and by Ahmad in 
    al-Musnad (2/311) from Abu Hurayrah (may Allaah be pleased with him) 
    that the Prophets  (peace and blessings of Allaah be upon him) said: 
    “The illegitimate child is the most evil of the three” meaning more evil 
    than his parents. Among the scholars who classed this as hasan were Ibn 
    al-Qayyim in al-Manaar al-Muneef (133) and al-Albaani in 
    al-Silsilat al-Saheehah (672). 

    The scholars interpreted this hadeeth in a number of ways, 
    the most famous of which was that suggested by Sufyaan al-Thawri, who said: 
    it means he is the most evil of the three if he does the same action as his 
    parents did (i.e., zina or adultery). 

    This was narrated from ‘Aa’ishah, who said that the Prophet 
     (peace and blessings of Allaah be upon him) said: “He is the most evil 
    of the threeif he does the same action as 
    his parents did – meaning the illegitimate child.” Although its isnaad is 
    da’eef, it was interpreted in this manner by the salaf, as stated above. 

    This interpretation is supported by the report narrated by 
    al-Haakim (4/100) – with an isnaad of which al-Albaani said, “It may be 
    regarded as hasan” – from ‘Aa’ishah (may Allaah be pleased with her), that 
    the Prophet  (peace and blessings of Allaah be upon him) said: “The 
    illegitimate child does not bear any part of his parents’ burden of sin.
    ‘and no bearer of burdens shall bear the burden of 
    another’ [al-An’aam 6:164 – interpretation of the meaning].” 
    (al-Silsilat al-Saheehah, 2186) 

    Some scholars said that this hadeeth is to be interpreted as 
    meaning that there is some evil in most illegitimate children because they 
    are created from an evil nutfah (sperm drop), and usually nothing good is 
    created from an evil nutfah. If a good soul comes out of this nutfah then it 
    will enter Paradise. This hadeeth is to be taken as a general rule to which 
    there may be exceptions. (See al-Manaar al-Muneef, 133). 

    Hence Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on 
    him) said: “If an illegitimate child believes and does righteous deeds, he 
    will enter Paradise, otherwise he will be punished for his deeds just like 
    anyone else. The punishment is for the deeds, not for the lineage. Rather 
    the illegitimate child is condemned because he is expected to do evil deeds, 
    as often happens. By the same token, good lineages are regarded as 
    praiseworthy because such people are expected to do good deeds. But when a 
    person does a deed, then the reward or punishment is based on that, and the 
    most noble of people before Allaah are those who are most pious. (al-Fataawa 
    al-Kubra, 5/83). 

    It says in Fataawa al-Lajnah al-Daa’imah: “If an 
    illegitimate child dies in Islam (as a Muslim), he will enter Paradise, and 
    his being illegitimate does not have any effect on that, because that was 
    not due to his own actions, rather it was the action of someone else. Allaah 
    says (interpretation of the meaning): 

    ‘and no bearer of burdens shall bear the burden of 
    another’ 

    [al-An’aam 6:164]

    And Allaah says (interpretation of the meaning): 

    ‘Every person is a pledge for that which he has earned’

    [al-Toor 52:21]

    And there are other similar verses. 

    With regard to the words narrated from the Prophet  
    (peace and blessings of Allaah be upon him), ‘No illegitimate child will 
    enter Paradise,’ this hadeeth is not saheeh. It was mentioned by al-Haafiz 
    Ibn Jawzi in al-Mawdoo’aat, but it is one of the ahaadeeth that were 
    fabricated against the Prophet  (peace and blessings of Allaah be upon 
    him). And Allaah is the Source of strength.” 

    With regard to the ruling on marrying one who is 
    illegitimate, none of the reputable fuqaha’ have stated that this is haraam. 
    However there was some difference of opinion among the Hanbalis as to 
    whether such a person is compatible with a woman of good lineage. Some of 
    them said that he is compatible with her, and othesr did not agree with that 
    because that will be a source of shame for the woman, because he will be her 
    guardian, and that would also affect her child. (See al-Mughni, 
    7/28).

    (al-Mawsoo’ah al-Fiqhiyyah, 34/282). 

    Shaykh Ibn Baaz (may Allaah have mercy on him) was asked 
    about a man who married his daughter to a person who was apparently 
    illegitimate – what was the ruling on that? He answered as follows: 

    “If he is Muslim, then the marriage is sound, because the sin 
    of his mother and the one who committed zina with her does not rest on him. 
    Allaah says ‘and no bearer of burdens shall bear 
    the burden of another’ [al-An’aam 6:164 – interpretation of the meaning].  
    And there is no shame on him because of their action, if he adheres 
    steadfastly to the religion of Allaah and develops good characteristics, 
    because Allaah says

    ‘O mankind! We have created you from a male and a female, 
    and made you into nations and tribes, that you may know one another. Verily, 
    the most honourable of you with Allaah is that (believer) who has At-Taqwa 
    [i.e. he is one of the Muttaqoon (the pious)]. Verily, Allaah is 
    All-Knowing, All-Aware’

    [al-Hujuraat 49:13]

    And the Prophet  (peace and blessings of Allaah be upon 
    him) said, when he was asked who is the most noble of people, ‘Those who are 
    most pious.’ And he  (peace and blessings of Allaah be upon him) said: 
    ‘If a person’s actions make him less worthy than others, his lineage will 
    not make him more worthy.’” 

    From Fataawa Islamiyyah, 3/166.

     And Allaah knows best.