Roman soldiers generally did not fight with their lovers by their side. Remember, Roman soldiers weren't even allowed to marry during for the first two centuries of the Principate.
Periodic scandals involving officers abusing their subordinates were attested in the armies of the mid and late Republic. Valerius Maximus, the main source of these incidents, reported that the military tribune Marcus Laetorius Mergus was condemned for molesting his adjutant. During this period at least, it seems clear that relations between fellow soldiers were punished - often with death. Apparently, Romans did not like the thought of "one of their own" being penetrated.
However, homosexuality with male slaves was quite mainstream in Roman society. Or at least, penetrative (on the part of the Roman) sex with his own slaves were quite acceptable. In this regard it seems the military did not function differently from the rest of their society. For example, Marcus Valerius Martialis wrote a poem commemorating a centurion friend, Aulus Pudens, and his relationship with his slave boy Encolpos. Unlike the case of a Roman being penetrated, here the passive partner/victim was already considered degraded and further defiling wasn't of concern.
Additionally, it was common and probably expected that soldiers would rape captives in a war. This included both women and the boys. That also extended subjected peoples. For example, the Revolt of the Batavi was said to be in part provoked by the Roman military's sexual assault of Batavi boys. In this scenario and that of the sex with male slaves, the homosexuality would seem to be an expression of manly virility.