The point is that you are not congratulating them for having sex, but for the child which they are expecting. It is never sinful to have a child. It is always something to be congratulated. The situation of the parents is not always something to be congratulated, but the birth of the child is.
Would you also refuse to congratulate a married couple for having a child? After all, all their doing is what is expected, not murdering their child, so hey, why would you ever congratulate them for doing something that is expected of them? And if you say that you would congratulate them anyway, but not because they are just doing what is expected, not murdering their child, then what are you congratulating them for? Having marital relations? Do you really think they would appreciate being told congratulations if they knew that was what you were congratulating them for? I seriously doubt it.