It is narrated from Ikrimah (may Allah have mercy on him) that some people from Iraq came and said: "O Ibn Abbas (may Allah be pleased with them both)! What is your view: is the ritual bath on Friday obligatory?" He said: "No, but it is better for the one who takes the bath, and whoever does not take it, it is not obligatory upon him. I will soon tell you how the ritual bath began. The people used to work hard and wear woollen clothes and carry loads on their backs; the mosque had a narrow, low roof, it was only (palm) branches. The Messenger of Allah (peace and blessings be upon him) came out on a hot day, and the people were sweating in those woollen clothes, until a bad smell spread from them (in the mosque) by which some people were troubled. When the Messenger of Allah (peace and blessings be upon him) noticed the smell, he said: 'O people! When it is Friday, take a ritual bath, and whoever among you has oil and perfume, let him apply it.'" Sayyiduna Ibn Abbas (may Allah be pleased with them both) said: "Then Allah Almighty granted abundance, so they stopped wearing woollen clothes, they were relieved of the work, their mosques became spacious, and the discomfort that used to be caused by sweat went away."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الطهارة / 1407