Some scholars regarded it as mustahabb to pray two rak‘ahs before consummating the marriage with the wife, but that is not narrated in the Sunnah of the Prophet (blessings and peace of Allah be upon him). Rather it is narrated that some of the Sahaabah (may Allah be pleased with them) did that.
It was narrated that Abu Sa‘eed, the freed slave of Abu Usayd, said: I got married when I was a slave, and I invited some of the Companions of the Prophet (blessings and peace of Allah be upon him), among whom were Ibn Mas‘ood, Abu Dharr and Hudhayfah. … And they taught me and said: When your wife enters upon you, pray two rak‘ahs, then ask Allah, may He be exalted, for the good of what has entered upon you and seek refuge with Him from its evil, then go ahead and approach your wife. Narrated by Ibn Abi Shaybah in al-Musannaf (3/401) and ‘Abd al-Razzzaaq in al-Musannaf (6/191). Shaykh al-Albaani (may Allah have mercy on him) said: Its isnaad to Abu Sa‘eed is saheeh.
It was narrated that Shaqeeq said: A man came to ‘Abd-Allah -i.e., ibn Mas‘ood] who was called Abu Jareer, and said: I have got married to a young girl and I am afraid that she will dislike me.
‘Abd-Allah said: Love is from Allah and dislike is from the Shaytaan, who wants to make hateful to you that which Allah has permitted to you. So when she comes to you, tell her to pray two rak‘ahs behind you. Narrated by Ibn Abi Shaybah in al-Musannaf (3/402); ‘Abd al-Razzaaq in al-Musannaf (6/191); al-Tabaraani in al-Mu‘jam al-Kabeer, 9/204.
Shaykh al-Albaani (may Allah have mercy on him) said: Its isnaad is saheeh.
Shaykh Ibn Baaz was asked: They say that there is a prayer for getting married and they call it Sunnah or Sunnat al-zawaaj (the Sunnah of marriage), and it is before consummation. And they say: Pray two rak‘ahs, and after that comes the consummation. Please advise us, thank you.
It is narrated in some reports from some of the Sahaabah that one should pray two rak‘ahs before consummating the marriage, but there is no reliable report concerning that in terms of soundness. But if you pray two rak‘ahs as some of the early generation did, there is nothing wrong with it; and if you do not do that, there is nothing wrong with it. The matter is broad in scope, but I do not know of any reliable, saheeh Sunnah concerning the matter.
With regard to the ruling on whether the recitation in this prayer should be out loud or done quietly, if it is nighttime then it should be recited out loud, and if it is daytime then it should be recited quietly. And any passage from the Qur’aan may be recited.
With regard to the du‘aa’, he should put his hand on the front of her head and say: “Allaahumma inni as’aluka khayraha wa khayra ma jabaltaha ‘alayhi wa a‘oodhi bika min sharriha wa min sharri ma jabaltaha ‘alayhi (O Allah, verily I ask You for her good and the good of what You have created in her, and I ask seek refuge with You from her evil and the evil of what You have created in her).” Narrated by Abu Dawood (2160); classed as hasan by al-Albaani in Sunan Abi Dawood.
There is no report in the Sunnah – as far as we know – to specify the time for this du‘aa’, so if one wishes, it may be recited before praying the two rak‘ahs or after.
And Allah knows best.