If there are poskim that say that aryos [internet/joining the army] is yehareg ve’al ya’avor – why doesn’t the same idea apply to walking in the street because there are also arayos?
1. Although there is a prohibition of placing oneself in a position/place where one will be exposed to arayos (meaning, in this context, to immodesty that is liable to provoke improper thoughts), this prohibition does not apply where there is no choice in the matter, or where there is legitimate reason to do so.
One has no choice but to walk in the street, and this is considered “leika darcha acharina” (based on Bava Basra 57b). It remains virtuous to avoid seeing immodest sights, even where one has no choice but to walk the streets. The Gemara writes that somebody who does this is considered a tzaddik, and applies the pasuk “one who guards his eyes from seeing evil.”
As Rav Moshe Feinstein writes (see Even Ha-Ezer 1:56, among other teshuvos), this applies to somebody who assumes that he will be able to avoid forbidden thoughts. Somebody who will not be able to prevent himself from this has to, indeed, find an alternative route, or to find a way of distracting himself.
2. Note that not every time the words “yehareg ve’al yaavor” are mentioned, must we assume that the intention is that one must be prepared to actually be killed for it. This depends on the context of the statement, on whether it is written as an actual “shut” or as a public declaration, and so on.