Vietnam
Taking KIA's as a good cross-section of the serving force, the average age (according to (Combat Area Casualty File) November 1993) was 22. However, using publicly available information, it appears this figure is closer to 23 (see below).
Assuming KIAs accurately represented age groups serving in Vietnam, the average age of an infantryman (MOS 11B) serving in Vietnam to be 19 years old is a myth, it is actually 22 [CACF]
Source: http://www.vhfcn.org/stat.html
We can also easily verify this data using the casualties by age statistics on the archives.gov website (Thanks @Oliver_C). Using this data (and extrapolating slightly) to assume that the 4,927 deaths of soldiers 30-39 were evenly spread across each year of age, and making the same assumption for the 40-49, 50-59 and 60-62 age bands gives us the following table of data:
Age Casualties
17 12
18 3103
19 8283
20 14095
21 9705
22 4798
23 3495
24 2650
25 2018
26 1414
27 917
28 768
29 710
30 492.7
31 492.7
32 492.7
33 492.7
34 492.7
35 492.7
36 492.7
37 492.7
38 492.7
39 492.7
40 115.6
41 115.6
42 115.6
43 115.6
44 115.6
45 115.6
46 115.6
47 115.6
48 115.6
49 115.6
50 12.1
51 12.1
52 12.1
53 12.1
54 12.1
55 12.1
56 12.1
57 12.1
58 12.1
59 12.1
60 40.33333333
61 40.33333333
62 40.33333333
A weighted average gives us a figure of 22.96
(Standard Deviation: 5.85
) which is pretty close to the linked information above from the CACF. Somewhat interestingly, the median of this same data set is 21
- one year the opposite way from the quote at the start of this answer!
Furthermore, it appears that in times of war when a Draft is in operation (as it was for the Vietnam conflict) soldiers are drafted using a lottery process starting with 20 year olds, followed by 21, 22, 23, 24 and finally 25 year olds (source). It would seem that this would further the argument that the average age of combat soldiers was into the early 20's as this would have been the largest group of drafted soldiers.
WWII
The average age (according to General William C. Westmoreland before the Third Annual Reunion of the Vietnam Helicopter Pilots Association (VHPA) at the Washington, DC Hilton Hotel on July 5th, 1986) was 26
The average man who fought in World War II was 26 years of age. [Westmoreland]
Source: http://www.vhfcn.org/stat.html
Finding similar data to the above for Vietnam in order to verify with some simple statistical analysis is proving hard.