Sahih al-Bukhari #4320
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi) 64:350
Narrated Ibn `Umar:
When we returned from (the battle of) Hunain, `Umar asked the Prophet (ﷺ) about a vow which he had made during the Pre-lslamic period of Ignorance that he would perform I`tikaf. The Prophet (ﷺ) ordered him to fulfill his vow.