Is it a sin to have a baby out of wedlock?
It is a sin to have sex outside of marriage (Hebrews 13:4). It is called "fornication" in the Bible, though some translations use the phrase "sexual immorality" or just plain "morality" for the same Greek word. The sin exists whether a child is conceived or not. But the conception of a child is one of the normal consequences of sex.
Many compound their sin by trying to avoid the consequence through aborting the baby; thus, adding murder on top of fornication. "Keep yourself far from a false matter; do not kill the innocent and righteous. For I will not justify the wicked" (Exodus 23:7). It is not the child's fault that his parents had sex before forming a committed union through marriage. The proper thing to do is have the baby and if the mother doesn't wish to raise the child, place the child with a family who do want a baby. Then the child will have the benefits of a solid family.