Drug molecules, even when stored safely inside a tablet\capsule, inside a closed container, upon a high shelf (hopefully), are still exposed to the environment, and are thus exposed to all of the chemical processes and reactions that go about all around us (to name just a few - oxidation, hydrolysis, isomerization, polymerization, and more). Depending on the type of drug molecule and its functional groups, the molecule may undergo all kinds of chemical processes that may change its structure and\or properties.
Therefore, drugs (and foodstuffs, as mentioned in the comment above) degrade and decompose over time, and are thus given an expiration date to indicate that after a certain amount of time, the drug's manufacturer strongly recommends to avoid using the product.
An important remark should follow: the expiration date refers to the entire pharmaceutical product, i.e. the formulation, and not just the active ingredient. It is absolutely possible that the active ingredient will remain stable for a long time, but some inactive ingredient (excipient) in the tablet\capsule\syrup will have undergone some decomposition that may render the product ineffective, or even worse, toxic.
A quick Google search for "drug decomposition" or "drug degradation" yields many useful results for further reading. To name just a few:
Understanding the chemical basis of drug stability and degradation
Drug degradation (Slideshare presentation)
Pharmaceutical degradation (Slideshare presentation)
And here's a non-scientific article addressing the issue from another angle: That Drug Expiration Date May Be More Myth Than Fact (might be an interesting read for you as well)