Abortion and the acknowledgment of an illegitimate offspring
What is the ruling of religion for permitting abortion and the acknowledging an illegitimate offspring?
Islam prohibits all forms of deviant sexual behavior including fornication, adultery and homosexuality, considering them amongst the grave sins. Protecting the rights of offspring is among the reasons for legislating marriage and, for this reason, Islam commands everything that leads to it and prohibits anything that distracts from it. It commands chastity and virtue and prohibits immorality, wrongdoing and tyranny.
Furthermore, Islam prohibits men from imitating women and vice versa. It attributed to each gender the characteristics and functions that suit their constitution and tied all this to judgment on the Day of Judgment, administering the earth and purifying the self.
Muslims therefore firmly believe that violating these [Divine injunctions] destroys society and portends evil consequences both in this world and in the Hereafter; it is considered a great corruption upon the earth that must be resisted and its perpetrators advised against and shown its evil ramifications.
Islam prohibits any assault against Allah's creation; it therefore prohibits abortion unless there is a medical necessity to preserve a woman's health. Moreover, Islam seeks to preserve lineage which is an objective of Islamic law, it does not acknowledge any sexual relationship between the sexes outside of a legal marriage, and deems paternity as based on a legal affiliation rather than a natural one.
Adultery and paternity
Islamic law does not recognize the paternity of a fornicator and deems the semen ejaculated during fornication as forfeit. 'A`isha narrated that the Prophet [pbuh] said, "The child belongs to the man on whose bed it is born and the fornicator is to be stoned" [Muslim and Bukhari]. Moreover, the tables are turned against the fornicator as he cannot attribute to himself a child he conceived from an illicit relationship. Rather, the child is attributed to its mother because maternity is a natural relationship unlike paternity which cannot be established except by a lawful marriage.
Allah Almighty knows best.