The foreskin (prepuce) is most certainly not a useless piece of skin. The foreskin is the part of the penile skin that covers the glans. The foreskin is attached to the penis only at the base of the glans and by the frenulum and so is able to roll over the glans in a unique manner. When the penis is flaccid the foreskin naturally extends over the glans, although it can be manually retracted. During an erection the foreskin is usually retracted, but most men have enough foreskin that it can slide over the glans when erect. The foreskin is very stretchy, and quite sensitive. It is however much stronger than the glans that it protects.
Babies are born with a non-retractile foreskin, which protects the penis from faeces and urine. During childhood the degree to which the foreskin can be retracted gradually increases. The foreskin should never be forced back. If the foreskin cannot be retracted by adolescence a doctor should be consulted. The condition of having a non-retractile foreskin is known as phimosis.
The glans does not have skin in the same way that most other parts of the body do. It is like the inside of the mouth in that it is covered only by a mucus membrane. In circumsised individuals this membrane thickens, and some sensitivity is lost. The foreskin itself is also a source of erotic pleasure. Smegma is secreted by the foreskin, and acts as a sexual lubricant, helping minimalize chafing.
The foreskin protects the glans from day to day scrapes, which are dificult to heal. In hot climates it protects the glans from sunburn, and when it is cold the foreskin helps to prevent frostbite in the end of the penis.