بسم الله الرحمن الرحيم
(Fatwa: 81/81/D=01/1436)
The cotton mattress shall turn pure only after washing. It shall be enough to wash the part where the impurity is smeared. As far as the matter of sleeping over it is concerned, if you cover it with bed sheet and sleep over it then there is no harm. It is against caution to sleep without a bed sheet. You will not be impure merely by sleeping over it. Yes, if after sleeping you discharged too much sweat and the mattress turned wet and the impurity smeared with your body then in this case that part of the body shall become impure.
Allah knows Best!
Darul Ifta,
Darul Uloom Deoband