Researchers have known from an earlier animal study that this was likely the case.  This study looked at mice that genetically could not produce adequate Vitamin D levels. As I have mentioned in my link on Vitamin D, Vitamin influences literally hundreds of processes and chemical reactions in the body and one of them affects testosterone.
The researchers found that it does this through two primary mechanisms: 1) calcium balance and 2) aromatase regulation. Vitamin D’s primary purpose, you may recall, is to control the amount of calcium in our tissues and, calcium, as it turns out, is critical for everything from our bones to our neurons. For example, the researchers found that by supplementing these mice with calcium, they could partially restore their hormonal levels. However, a complete restoration was not achieved because Vitamin D also affects aromatase activity. Aromatase is the critical enzyme that converts testosterone to estrogen.
Of course, the acid question is if Vitamin D supplementation can actually raise Vitamin D levels in men? Fortunately, researchers have begun looking at this basic question. They started with overweight, nondiabetic, healthy men with lowish testosterone levels and gave them a little over 3000 IU of Vitamin D per day. Also, these men had what they considered to be low Vitamin D levels of less than 50 nmol/l.
What happened was remarkable: total, bioavailable and free testosterone levels increased by 25.2%, 20.0% and 20.3%, respectively.  Now this isn’t going to cure one’s hypogonadism, but it is a nice boost just from taking a cheap supplement, eh?
CAUTION: Recent research has shown that there is likely a rather narrow band where Vitamin D provides benefits and, furthermore, shows that high Vitamin D may actually be harmful. Check out my page on The Potential Dangers of High Vitamin D for more information.
Again, the bottom line is that there are a lot of guys out there wondering where their testosterone has gone, when, in reality, it’s simply that they are deficient in this all-important vitamin. Being indoors a lot, using sunscreen, having darker skin, being outside during non-peak hours – all of these things can lead to deficiencies in Vitamin D and, therefore, lowered testosterone levels.
1) Endocrinology, Apr 2000, 141:1317-1324, “Vitamin D is an important factor in estrogen biosynthesis of both female and male gonads”
2) Clin Endocrinol (Oxf), Dec 29 2009, “Association of vitamin D status with serum androgen levels in men”
3) Horm Metab Res, 2011 Mar, 43(3):223-5, Epub 2010 Dec 10, “Effect of vitamin D supplementation on testosterone levels in men”