Try to stretch your legs a little bit, by standing folding your legs and bringing up till your stomach. And then try to lossen your muscle, by shaking ur muscle very gently. If still it doesn't get better then it must be a serious problem. Better consult a doctor and get the medication course been done.
You must stretch regularly. Hold your foot up to below your buttocks for 1 minute every half hour. If this does not work after a day of doing it you may have a serious issue and should see a doctor.
If it is from an injury ice, compression wrap, and stay off of it for 2 to 3 days. If it is not, try eating bananas for the extra potassium and drink something like Gatorade for the electrolytes.
Use RICE principal for rehabilitation: Rest, Ice, Compression, Elevate. The two most important are ice and compression. Light stretching exercises also help. This should help spasm, pain and swelling.
Stay off the leg for a few days. Perhaps investing in a set of crutches to stay off the effected leg will give it time to heal and repair. Rest the leg and DO NOT RUN!