Why is soldier ˈsōljər? Where did the "j" come from?
Just a pronunciation question. Is it a vestige of the spelling battle between i and j, where in English the j lost out to the i, but with soldier we retained the sound?
Solution 1:
As others have mentioned, the pronunciation of soldier as /ˈsoʊldʒər/ is due to coalescent palatalization of /dj/ to /d͡ʒ/, a process that occurred in some contexts in most varieties of English (and that still occurs as a basically productive process between word boundaries in fast speech, as John Lawler mentioned).
It's related in a very general way to the reason why we pronounce words spelled with the letter "j" with /d͡ʒ/, but it's not directly related in the way that you suggested (that is, I don't know of any evidence supporting the idea that the use of /d͡ʒ/ in this word was based on a spelling with "j", or based on the graphical connection between "j" and "i").
It's a bit unusual that "di" is pronounced /d͡ʒ/ in "soldier": in most words spelled with "di" followed by a vowel letter, the "di" is instead standardly pronounced as a separate syllable /di~dɪ/ (for example, in the pronunciations of words like radiant, Canadian, melodious) which can optionally be compressed to non-syllabic /dj/.
However, there is clear evidence that pronunciations with /dʒ/ existed instead of or alongside pronunciations with /di~dɪ/ for many words with the "di + vowel" spelling pattern in the past. For example, the spelling "Injun" represents a variant with /d͡ʒ/ of the word "Indian"; this /d͡ʒ/-variant came to be seen as colloquial (or in modern times, offensive).
The sound /d͡ʒ/ from former /dj/ occurs more regularly in words spelled with "du", such as "education" or "procedure".
Solution 2:
The thing is [t] and [d] started palatalizing and later to merge with the following [j] producing the affricates [tʃ] and [dʒ] already in the eighteenth century. First [t] became [ʃ] in words like nation, then, later, the palatization extended to other environments (words like nature, mutual etc.)
Nowadays jod-coalization is becoming the norm also in stressed syllables tuesday sounding like "choose day", homophony between dune and june etc.