It's worth adding that unlike in modern societies, Rome relied on slave labor to a good extent. These don't count as citizens who could join the army, but they do substitute them on the labor/home 'front', meaning a larger proportion of citizens could thus be soldiers.
How many slaves exactly were in the Roman empire at any given time is however difficult to estimate. Still some attempts were made, e.g.:
From evidence such
as this Westermann, Hopkins and others are
understandably cautious when attempting to come to
a total figure for slaves in the city of Rome in the 1st
century AD. Hopkins' estimate of 300,000-350,000 out
of a population of about 900,000.
Other estimates on the number of slaves (p. 132) are in the range of 200,000 to half a million, even in the period 225-168 BC. [Also, the number of adult male citizens (in the empire) had risen to 1.4 million by the Augustan period. (But see below for more on that.)] One tally of the slaves captured between 217 and 167 BC is 388,000 (p. 136) but this probably doesn't include those traded/bought.
Generally speaking, the demographics of the Roman empire are still subject to [much] debate; quoting a [2013] book review (doi:10.1017/S0075435814000380):
From the early debates between David Hume and Robert Wallace, efforts at macro-scale
reconstruction of the Roman population have been marked by the wildest divergences.
Fundamental disagreements still abide between ‘high-counters’ and ‘low-counters’, who offer not
just different interpretations of Republican and Augustan census figure but entirely irreconcilable
visions of the trajectory, scale and nature of Roman development. Saskia Hin’s Demography of
Roman Italy is a remarkable contribution in many ways, but above all in that it is the only
compelling attempt, in over two centuries of research, to offer a comprehensive middle way.
Indeed, she provides the reader with a memorable handle for her reconstruction: the middle count. [...]
In the final section, H. takes the insights earned in the previous chapters to reconsider the problem of
total population size. She offers a novel solution to the classic problem of the relationship between the
census figures reported by Livy for the late Republic and the Augustan figure. To oversimplify the
issue, low counters argue that the earlier figures included all adult male citizens and the Augustan
figures included all citizens, for a total population under Augustus of around four million. High
counters argue that the Augustan figure included only adult male citizens, so that the total
population was maybe three times larger, or twelve million. H.’s ingenious argument is that the
early figures report sui iuris adult male citizens, while the Augustan figure included all citizens,
including women and children, sui iuris. Her principal evidentiary support for this view (though she
marshals a range of circumstantial evidence) is Livy’s remark that the earlier census did not include
widows and orphans; this statement, she argues, suggests a change in which subsequently widows
and orphans sui iuris were counted. A weakness of this argument, already pointed out by de Ligt,
‘is that married women sui iuris, one of the groups supposedly covered by the Augustan figure,
were evidently neither pupillae nor orbae’ (Peasants, Citizens, and Soldiers, 127). Thus, though H.’s
reconstruction is satisfyingly harmonious with a model of moderate long-range population growth in
the late Republic, it will not be the last word. Her final chapter, engaging with Launaro’s
reconstruction from survey archaeology, convincingly makes a case for more limited growth between
the late Republic and early Empire. Ultimately, the overall shape of the middle count model, with
moderate population expansion in Italy continuing into the first century C.E., is in broad terms
attractive, though the details of the census figure remain stubbornly confounding.
So, as a kind of conclusion on this angle: whether the army was large or small relative to the [whole] population depends how big the (ahem) population was. Which for the Romans we only have some disputed/interpetable numbers... some centuries later.
If you're willing to entertain undercounting (of the poorer population), then specific theories have been advanced, e.g.
How was Rome willing and able to maintain such enormous military forces, even as its traditional manpower pool shrank? The answer is surprisingly obvious, even if our sources do not fully admit it. During and after the Second Punic War, the Romans must have disregarded the wealth qualifications for military service. The proletarii, the Romans too poor to afford citizenship, were a large group which the census routinely undercounted. It is only through their widespread participation in the military that we can explain Rome’s ability to wage war on such a scale and for so long.
Indeed, the census bears out this theory. In 193, just five years after listing 144,000 Romans, the population of Roman citizens leapt up to 258,000. The only explanation for such a rapid rise is a change in the way Rome counted citizens. It seems likely that Rome became more willing to give out citizenship, partly as a way to bolster its manpower, and also that Rome began to devote more effort to counting the proletarii, whose military service was finally vital to the state.
The sources do not mention the widespread recruitment of the poorer classes, but Polybius does suggest that the Romans did sometimes ignore property requirements. The Roman historian Livy, for his part, recounts the story of Spurius Ligustinus, a poor Roman who joined the legions in 200 BCE and served for 22 years, winning immense fame for his courage and skill. Livy mentions that Spurius Ligustinus did not meet the minimum criteria to enter into the legions, yet he gained entry nonetheless, despite the fact that the Second Punic War was by that point won. The existence of soldiers like Spurius Ligustinus points to a systematic bending of the property qualifications in the Roman army, even after the crisis of the Second Punic War was over.
Note however that Wikipedia somewhat disagrees with this:
For much of the 20th century, historians held that the property qualification separating the five classes and the capite censi was reduced over the course of the second century to a nugatory level due to a shortage of manpower. The basis for that belief, however, was merely three undated Roman figures for the amount of property required to serve which would serve as evidence for reductions only if forced into a descending order.[18][19] Many scholars have also now abandoned the notion that Italy suffered in the second century BC any deficit of manpower which would have driven such putative reductions.[20][21][22]
Whether that's a fair summary of the scholarship, I'm not sure. The sources 20-22 are a book in French (PhD thesis) and this 1983 45-page paper.
OP quotes
In 211 BC the Romans had 25 legions and auxiliaries
These numbers have also been somewhat disputed in that last paper I mentioned (and which Wikipedia considers authoritative), but anyhow that peak figure seems to diverge from the mean in later years a fair bit:
If Livy's legion lists are authentic, 20 or more legions were in service
every year from 214 to 206, with a peak of perhaps 25 in 212. Although I am
sceptical about a good deal of Livy's information on this subject, I think it
unlikely that the totals he implies should be much reduced. Calculations of
the number of men serving can only be conjectural, for many of the legions
must have been seriously under strength. Brunt estimates that there were never
less than 60,000 legionaries in service between 215 and 207, with a peak of
80,000 in 212. These figures are likely to be of roughly the right order of
magnitude, and may even err on the side of caution.
The number of legions and legionaries in service in the years 200-168 have
been calculated by Afzelius and Brunt on the basis of Livy's evidence.
Although some points of doubt subsist, the margin of error is not likely to be
great. On Brunt's figures the average number of legions in the field in these
years was 8.7. If we assume that the legions were kept up to a nominal strength
of 5,500, the average number of legionaries was 47,850. In thirteen years ten or
more legions were in service. During the war with Antiochus Rome fielded
12-13 legions: her effort then was of the same scale as in the Hannibalic War.
[...] It is unlikely that as many as ten legions
were fielded except for two brief periods, 148-6 and 105-1, and possibly the
year 135. The average number of legions in the intervening period according to
Brunt's table is 6.4 - at full strength, 35,200 men.
Whether that's because the greatest emergency/motivator had passed or the numbers were a bit inflated for 211, YMMV. Anyhow, the number is service at any given time is well below the cumulative dead.