It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that Banu al-Harith bin Nawfal bought Sayyiduna Khubayb (may Allah be pleased with him), and Sayyiduna Khubayb (may Allah be pleased with him) had killed al-Harith bin Nawfal at the Battle of Badr. Sayyiduna Khubayb (may Allah be pleased with him) remained with them as a captive until they resolved to kill him. Sayyiduna Khubayb (may Allah be pleased with him) asked the daughter of al-Harith to lend him a razor so that he could remove his pubic hair, and she gave him the razor. A little son of hers crawled up to him while she was unaware. When she saw, the child was sitting on the thigh of Sayyiduna Khubayb (may Allah be pleased with him) and the razor was in the hand of Sayyiduna Khubayb (may Allah be pleased with him). She was alarmed, and he noticed her alarm and said: "Do you think that I would kill him? I am not one to do that."
Imam al-Bukhari (may Allah have mercy on him) narrated it from Musa bin Isma'il. If he did not trim (his hair and nails) before he died, then Imam al-Shafi'i (may Allah have mercy on him) says that some of our companions did not consider it right to cut the hair or trim the nails after death, while some of them saw no harm in it. The Shaykh said that al-Hasan (may Allah have mercy on him) and Ibn Sirin (may Allah have mercy on him) say that neither nails nor hair are to be cut. It is narrated that Sayyiduna Sa'd bin Abi Waqqas (may Allah be pleased with him) washed a deceased person, called for a razor and shaved the pubic hair. Sayyidah Aishah (may Allah be pleased with her) said: "Will you not tidy your dead?" meaning, will you not cut his hair; as if she disliked it, as long as he could be combed.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 6636