I was lucky and got Jesse's cot and matress from my sister. She did say to me at the time that SIDS recommended you dont use second hand matresses. But because it was my sister and i know none of her kids have any illnesses, my sister and brother-in-law dont smoke or have any pets and the matress was well looked after with matress protectors etc, im using it.
So it is up to you i guess, on how worn the matress is etc, but if i was to be given one from someone other than my family, i would personally purchase a new matress just to be on the safe side.