Wa alaykum salam wa rahmatuLlahi wa barakatuHu,
From the As-hab al-Wujuh there are differing opinions related on whether performing ablution while retiring to bed is recommended. Imam Nawawi related from Imam Baghawi that it is not, and from Mahamili in his Lubab that it is. (Majmu’ 1/324) Imam Nawawi preferred what he related from Mahamili’s Lubab because of the narration from the Prophet Muhammad (upon him be peace) who said: “When you retire to bed, perform ablution and then lay on your right side and say....” (Sahih al-Bukhari #247; Sahih Muslim #56)
(Note: In Baghawi’s Tahdhib 3/229, he related an opinion from Ibn Abi Hurayrah that it would not be acceptable for one performing ritual seclusion to exit from the mosque to perform ablution at the time of sleeping when able to do so inside. Baghawi seems to accept this tafsil.)
While the Shafiyyah prescribe retiring to bed with ablution as a recommendation, they also clearly maintain that in any instance in which one would have skin-to-skin contact with one’s wife, the ablution would be thereby invalidated. There is no contradiction between these. The recommendation of performing ablution before sleeping is to establish the ritual as something one does prior to retiring for bed and going to sleep, similar to extinguishing one's lantern and applying ithmid to the eyes.
And Allah knows best.