Roman style
In Roman times, there were two forms of the letter I in use: the standard I, and a taller glyph ꟾ now referred to as I longa, which had several uses.  Canonically it indicated the ‘long’ vowel we might spell ī today; although the Romans had diacritical marks (called apices) for long vowels, they preferred to use I longa rather than place an apex on an I.  In the second century, Scaurus writes:
Super I tamen litteram apex non ponitur; melius enim I in longius producitur.
The apex is not placed on the letter I, though; it is better to extend it into the longer I.
The I longa was also used in words like Imperator, a usage similar to capitalization for respect in English. More pertinently, I longa was also used, at times, for intervocalic consonantal I (which in Latin was long in itself, e.g. in eius, actually pronounced eiius). This usage may not have been limited to initial and intervocalic use alone; Christiansen in De apicibus et I longis brings forward several examples where the I longa was used to spell words that did not canonically have long I in classical Latin: inscriptions such as OCTAVꟾO, COMITꟾA, and PERSECUTꟾO are found; he suggests that the meaning of I longa was not, in these cases, a miswriting of a long vowel for a short—”si hoc verum esset, plus sescenties lapicidae erravissent”—but perhaps already was beginning to represent a consonantal value extant in popular speech.
This consonantal value was later more strongly associated with the I longa; in further ages it began to be reckoned not merely an orthographic variant, but as a letter in its own right. Though in many languages new names were given to it, in Italian it is still called I lunga.
From the Roman viewpoint, a J encountered in a foreign word might or might not be recognized as an I longa.  In the former case, it might be written in whatever style I longa is represented (including as simple I), while in the latter case the J should be treated as with any non-Latin letter.
Modern style
Modern languages treat I and J as separate letters. For some, such as German, J still has the same consonantal value it had in Latin; for others, its value has undergone various changes, as the /dÊ’/ of English, the /Ê’/ of French, and the /x/ of Spanish.
While J may still retain its semivocalic sound in some places, and in some ornate typefaces I and J are identical, I do not believe any modern language uses J as a full vowel. J should thus only be used for the consonant in Latin.
As J is often understood in Latin contexts as a modified or accented form of I—“letter I with tailâ€, so to speak—an editor might choose to eschew it when not using any other accent marks. However, when using accented Latin, whether with the macrons and breves of learners’ texts and dictionary headwords, or with the acutes, graves, etc. common in prior centuries, J should be retained. For the same reason, the letter J when used should sort together with the letter I, when technology allows.
The decision whether to use both I and J does not need be parallel to the decision whether to use both U and V – the latter has the additional factor of a split in pronunciation of the semivowel exemplified in the word suavis: both semivowels were the same in classical Latin, but non-classicizing pronunciations such as the Italian turn the latter semivowel into a consonant and leave the former with its original semivocalic value; I am not aware of any systems of pronunciation where a similar split happens with J.
If J is used for native Latin words, then J in loanwords should be treated similarly.  If the editor chooses not to use Latin J, then non-Latin J should be treated as any other non-Latin letter.