The penis excretes fluid as a clensing mechanism.
It is your job to clean this fluid up - it happens to girls as well - the vagina has a self clensing mechanism (some girls need to wear pantyliners to absorb this fluid.
When you penis is in your pants all day the fluid that has seeped out dries and in doing so gives the appearance of "gluing" the foreskin together over the head of the penis.
Just wipe it off with a damp cloth or tissue and be sure to keep it clean.