I had decided to bike a longer route than I usually do and ended up getting caught in the rain and biked back to my car with some extreme leg cramps. It was extremely painful, but I didn't want to get caught past dark in the rain and the trip back was a little less than 2 hours. I had barely made it back before my legs completely locked up, but the cramps gradually let up and I was able to walk normally again with just some minor muscle soreness. I understand that the situation that I put myself in was preventable, but I was curious if there is any permanent damage done when pushing through cramps when exercising.
I highly doubt it. In general, cramps are caused by electrolyte imbalances and make your muscles contract uncontrollably for a period of time. The long term damage would be no more than what would happen if you contracted your muscles for the same amount of time. Now, you will need to fix the electrolyte imbalances with proper rest and hydration.
According to the article that I linked to, the only time you should be concerned is if you chronically get the cramping in the same set of muscles without causing the cramp by your exercise. It's an indication of nerve root disease. However, that doesn't apply to the situation you described here.
The best prevention for cramps is a good hydration routine. When you are doing long distance biking or running, you should probably keep some Gatorade or other sports drink on you so you can remain hydrated throughout your ride. The sports drinks help maintain the proper electrolyte imbalances so you don't experience the severe pain that you did.