If the towel had a man’s sperm on it, and you rubbed it between your legs, there is the slight chance that it could have gotten you pregnant, not likely, but possible.
Your own masturbation of yourself, cannot get you pregnant.
To become pregnant, a man’s sperm must get inside of your vagina, either through actual sex, or by way of accidentally splashing it onto the outside, near the vagina (if the male was masturbating onto you, or close enough to you that some of it could have gotten into your vagina, or by it being transferred into your vagina by means of a sperm-laden towel, or his or your fingers if there was some sperm on them.
You should definitely take a pregnancy test to be certain.
For the future, and for a little peace of mind now, here are the ways to avoid getting pregnant: http://www.momjunction.com/articles/precautions-to-avoid-pregnancy_00183/
Good luck, check back in with us if you need more guidance after you take the pregnancy test.