The muscles in the back of my leg have been sore lately. What is the cause?

Leg pain. Need much more information e.g. Age, activity, work, athletics, male or female, pregnant, injury etc.
Several possibilitie. It could be the result of recent activities and you have made the muscles sore from exercise (mountain climbing, stairs, etc.) or could be from medications that cause muscle soreness. There could be a bruise from a direct blow. You could possibly have a clot in the calf and this is serious. There are other less common causes of leg muscle soreness. If concerned see your pcp right away.