AV, I chose to say Numbers 31 rather than Numbers 31: 18-19 for a reason: I feel context is most important here.
First, we know that the Jews faced the adult men in combat and beat them, then they rounded up all the women, and children (both child men and child women). We know that young virgins alone numbers over 32,000 (see Numbers 31:32), so we can make a pretty reasonable guess that the total number of non-virgins was in the tens of thousands as well.
Now, they decided to slaughter every single one of the helpless non-virgin girls and all boys regardless of virginity, right in front of the eyes of the virgin girls- though to be fair, this command came from moses, not directly from God (at least the bible does not make such a claim), but Moses decided to keep alive the virgin girls.
So, we are faced with the question of why keep them- and we have several options.
A) They wanted to have sex with the virgin girls. You would want virgin ones because they are usually both STD free and are unlikely to be holding a child from the 'other' tribe claiming he is a Jew from the captors.
B) They wanted them as slaves - though we can rule this option fairly safely out as there is no reason to only choose virgin girls... boys, regardless of virginity, would be considered better slaves for most cases (hence why they cost more)
C) They wanted to have compassion- We can rule this option out because, once again, compassion would not involve slaughtering 4 year old boys.
Or D) Another option that I have not thought off.
From this, we can see that they wanted the virgins for sexual purposes.
Once this is established, we then decide if they engaged in consential sex or in rape. This is not actually addressed in the bible however we have a good reason to assume it was rape, namely that these young women just saw their mothers, sisters, and young brothers slaughtered, defenseless, by their captors. This would naturally cause the vast majority of them to hate their captors, let alone not wish to have sex with them.
Sure, some of them would be willing for whatever reasons (perhaps due to desperation, depression, or apathy induced from the war-crimes of the Jews) but certainly not all. We are not given a hint to what happened to the virgins that said no, but we can fairly safely assume that they were not released to run free (otherwise why not let the non-virgin girls go free from the get go?) So they were either raped or killed.
If they are killed, I think we can still assume that it was rape for the ones that were not because they saw the first wave get killed, and if you have an option of 'have sex with me or die' you will lie, saying you accept, when in reality you are just engaging in the act to save your life- I would hope we can agree that this is still rape.
I hope that answers your question about how I got this view?
Btw, your response that it was virigns because of STD protection only works if they entended to have sex with them. If you do not plan to have sex with them, why on earth would you worryif they have STD's or not?