Although this is a Companion report, it is treated as a report traced back to the Prophet.
It is prescribed for a Muslim who sleeps through his witr prayer, or is prevented from performing it by pain or the like, to perform it during the day. Regarding the number of rakʿahs, he may choose between two options:
The first is to perform his witr prayer as he usually did.
This is derived from the statement of the Prophet, peace and blessings be upon him, in the hadith of Abū Saʿīd al-Khudrī, who reported that the Messenger of Allah, peace and blessings be upon him, said: “Whoever sleeps through his witr prayer or forgets it should perform it when he remembers.” Narrated by Abū Dāwūd and al-Tirmidhī. (1)
The second is to perform twelve rakʿahs during the day.
This is what ʿĀ’isha, may Allah be pleased with her, related concerning the practice of the Messenger of Allah, peace and blessings be upon him. She said: “Whenever sleep or pain prevented him from performing the night prayer, he would perform twelve rakʿahs during the day.”
Narrated by Muslim. (2)