There are a number of accounts of this fact. Without trying to go back to the earliest linguistic accounts of this, the Sound Pattern of English by Chomsky & Halle has a account of stress-levels, especially regarding the difference between words versus phrases. The basic generalization is that within a word, stress would go on the penult in words like into, but "in two" is composed of two monosyllabic words (each of which has an independent stress). There is a long literature on which word will get the most prominent phrasal stress, and suffice it to say that in phrases like "in two", the second word (phrasal head) has higher stress. "To" in the word "into" would have lower stress, indeed shouldn't have any stress except by dint of the "veto" rule (p. 191).
Part of the problem has to do with the status of "into" / "in to", as word versus couple of words in a phrase. If you manipulate semantic focus, you can get "in two" and "in to" being pronounced nearly the same, for example "He broke in TO the jail, not out of it", with greater prominence on to, analogous to "The log broke in two".
The "veto" rule simply says that lax ɔ gets a 3-stress when it appears at the end of the word. The real question is, why would you claim there is such a rule? The "veto" rule exploits a putative lexical distinction between tense versus lax o at the end of a word, motivated by the difference between "veto" versus "motto". The claim is that the last vowel in "veto" has 3-stress, and the last vowel in "motto" is unstressed. The fact supporting the claim for this difference is that "t" is flapped in "motto" but not in "veto"; we do know that in cases of intervocalic t before a secondarily stressed vowel, t is not flapped, for example "latex", "solitude". The stress difference between "latest" and "latex" on the final syllable is uncontroversial and evident via the vowel quality difference.
The problem with "veto" versus "motto" is that there is actually no phonetic difference between the two vowels "o". This is not a problem for SPE, since they allow abstract representations. They require stresses to be predicted by rule. They do not actually provide a derivation of "into". It is most likely that "to" would be /tʊ/ with a lax vowel, so that it would not have main stress (*intó). But the last syllable is not obligatorily entirely stressless (not mandatorily "inna" with flapping and reduction of the final vowel to schwa). If "into" is /ɪntʊ/, the stress rule can skip the final vowel; then a generalized form of the "veto" rule applies, 3-stress is assigned to the last vowel which blocks reduction t schwa and flapping. The number "two" on the other hand is /tō/ with a tense vowel, so it always gets main stress (and only stress within that word).
The pair "veto, motto" is partially analogous to "into, winter", in that there is a problem of predicting when t flaps. By claiming 3-stress in "into", t won't get flapped (just as it won't get flapped in clear main-stressed "in two").