We have previously explained that the correct view is that it is permissible to congratulate non-Muslims on their personal, non-religious special occasions, if they do not involve anything that is contrary to shareeah. Please see the answer to question no. 127500
There is nothing wrong with you congratulating a young couple on their marriage after an illicit relationship, if that is done in words that are not objectionable, i.e., they do not suggest any justification of the previous relationship or approval of whatever religion they follow.
In terms of the words that may be used, you could wish them a happy marriage or say May God bless you, May God give you good children and other expressions that include prayers for happiness and blessings and so on, because happiness is a word that could imply being guided to Islam and refraining from prohibited things.
You could also include in your congratulations a prayer for them, that this be a suitable beginning to refraining from the previous illicit relationships, such as saying This is the best way, and so on.
If you can include in what you say to them an invitation to Islam, the religion of purity and chastity, that would be good, in the hope that Allah may decree that some of them be guided at your hands.
And Allah knows best.
Reproduced from Islam QA