The recruits were then monitored for an average period of 34 years, ranging from five to 41 years, during which all cases of a heart attack or death were recorded.
A clear link was found between fitness levels at age 18 and the chances of having a heart attack years later.
The researchers also found that regular cardiovascular training during adolescence was linked to a 35 per cent reduced risk of having an early heart attack.
Study leader Professor Peter Nordstrom, from Umea University in Sweden, said: "As far as we know, this is the first study to investigate the links between an objective measure of physical fitness in teenagers and risk of heart attack in the general population.
"Further studies are needed to investigate the clinical relevance of these findings, but given the strong association that we have found, the low cost and easy accessibility of cardiovascular training, and the role of heart disease as a major cause of illness and death worldwide, these results are important with respect to public health."
During the follow-up period, 7575 heart attacks were recorded among 620,000 men. Compared with those in the group that had the highest aerobic fitness at age 18, men in the lowest group were twice as likely to suffer a heart attack.
Body Mass Index (BMI), which can be used to measure obesity by relating height and weight, was found to make a big difference to heart attack risk during the follow-up period.
The fittest obese conscripts were 71 per cent more at risk of a heart attack than the most unfit lean recruits, and greater than four times more at risk than the fittest lean teenagers.
The scientists, whose findings are reported in the European Heart Journal, acknowledged the study had limitations, including the fact that BMI, fitness and blood pressure were only measured at the time of conscription.
It was not known how these factors may have changed in later years.
Prof Nordstrom concluded: "Our study suggests that it's more important not to be overweight or obese than to be fit, but that it's even better to be both fit and a normal weight."
David Stalker, chief executive of UKactive, a group which promotes exercise, said the study sent an important message to teenagers.
"This evidence shows that teens have to understand that being active on a regular basis and getting your heart rate going can be life changing," he said.
"It will make you feel better about yourself, improve your emotional and social wellbeing and get you better grades at school.
"Regular physical activity is absolutely vital during your teen years. Not only does being physically active at this stage of life aid social, mental and physical well-being, but also leads to better physical and mental health in the future."
- PAA