From Latin index "forefinger." (Oxford English Dictionary)
In the sense of indexical pronouns and similar expressions, these terms originate in the writings of Charles Sanders Peirce.
Peirce's first use of index is in Logic of the Sciences (1865). But the term seems here to be used in a somewhat different sense than in his later work:
...if the ground determines the subject in itself, there will be no relation of the representation to its object in itself but only in the subject. No quality of the object will be implied by the representation, therefore, since that would be a ground of agreement in the object. The representation will therefore be unsusceptible of truth. An imperfect example of such a representation is a proper name the ground of which is a convention between the persons who use it. Such a representation may be called an index. But the only adequate example of an index is the representation to one’s self of one’s own identity by one’s relation to anything.
The sense of index more typically associated with Peircian semotics, for a sign which represents its object by virtue of regularly cooccurring with it, is introduced in Logic Chapter I (1866):
In the second case, there is a real difference of the repraesentamen from its object, that is to say not a mere difference in quality but also a bringing of them together in nature; in this case the representative character of the one will consist in constant accompaniment by the other, so that it indicates the existence of the latter without noting any characters of it. Such a representation may be termed an index.
This is, perhaps, not very close to the way most of us would define "indexical expressions" today, in terms of denotation fixed by pragmatic context; but the same idea is implied: if an expression is regularly "accompanied" by the thing it represents, that means that the expression systematically represents a feature of the contexts where it is used.
Peirce was explicit that pronouns, which would be regarded as a paradigm case of indexical expressions now, are indices according to his classification. In Of Reasoning in General (1895) he writes:
Modern grammars define a pronoun as a word used in place of a noun. That is an ancient doctrine which, exploded early in the thirteenth century, disappeared from the grammars for several hundred years. But the substitute employed was not very clear; and when a barbarous rage against medieval thought broke out, it was swept away. Some recent grammars, as Allen and Greenough's, set the matter right again. There is no reason for saying that, I, thou, that, this, stand in place of nouns; they indicate things in the directest possible way... A pronoun is an index. A noun, on the other hand, does not indicate the object it denotes; and when a noun is used to show what one is talking about, the experience of the hearer is relied upon to make up for the incapacity of the noun for doing what the pronoun does at once. Thus, a noun is an imperfect substitute for a pronoun... A pronoun ought to be defined as a word which may indicate anything to which the first and second persons have suitable real connections, by calling the attention of the second person to it. Allen and Greenough say “pronouns indicate some person or thing without either naming or describing.” This is correct, refreshingly correct; only it seems better to say what they do, and not merely what they don’t.
I have been unable to identify specifically which work Peirce was referring to, in saying that the analysis of pronouns as substitutes for nouns was "exploded" in the 13th century; but this was about the time that "speculative grammar" began to flourish. The Modistae — the speculative grammarians par excellence — regarded nouns and pronouns as signifying via different "modes," with the result that a pronoun could not be interpreted as an equivalent substitute for a noun; but Modism arose relatively late in the 13th century, and is therefore probably not what Peirce had in mind. If any readers have a sense of what he did intend, please let me know.
The adjective indexical, as opposed to the noun index, also appears in Peirce, for example in his (1897) article The Logic of Relatives:
An indexical word such as a proper noun or demonstrative or selective pronoun has force to draw the attention of the listener to some hecceity common to the experience of speaker and listener.
Although these terms are due to Peirce, it was really Bar-Hillel's (1954) article Indexical Expressions which brought them into widespread use in semantic theory, and caused them to be associated more explicitly with the idea of having reference determined by pragmatic context. Bar-Hillel explains his choice of terminology:
It was C. S. Peirce who introduced the terms 'indexical sign' and 'index', Bertrand Russell used instead 'ego-centric particular', Nelson Goodman coined 'indicator', and Hans Reichenbach 'token-reflexive word'. I decided to use Peirce's term since it provides an adjective easily combined with 'sign', 'word', 'expression', 'sentence', language', 'communication' alike. (p. 369)
The use of the term index not for an indexical sign, but for a parameter relative to which an expression is assigned a denotation (as in modal or intensional logic) clearly developed from the general use of index in mathematics for the elements of a set with which objects are labeled — for example, the numbers 0, 1, 2,... serving as labels for a series of objects A0, A1, A2,... Generalizing, whenever f is a function from a set X to a set Y, we may regard f as "indexing" the members of Y with members of X, and regard the members of X as "indices." Where the members of X are possible worlds, or times, or pragmatic contexts, etc., and the members of Y are the denotations of a linguistic expression relative to those worlds, times, contexts, etc., we have the familiar notion from modal and intensional logic. This use of the terminology was popularized, if not introduced, by Scott (1970).
Bar-Hillel, Yehoshua (1954) 'Indexical Expressions', Mind 63.251.359–379.
Peirce, Charles Sanders (1865/1982) 'Logic of the Sciences', in Max H. Fisch, et al. (eds.), Writings of Charles S. Peirce: A Chronological Edition, vol. 1, pp. 162–302. Indiana University Press.
Peirce, Charles Sanders (1866/1982) 'Logic Chapter I', in Max H. Fisch, et al. (eds.), Writings of Charles S. Peirce: A Chronological Edition, vol. 1, pp. 351–356. Indiana University Press.
Peirce, Charles Sanders (1895/1998) 'Of Reasoning in General', in Nathan Hauser, et al. (eds.), The Essential Peirce, vol. 2, pp. 11–26. Indiana University Press.
Peirce, Charles Sanders (1897) 'The Logic of Relatives', The Monist 7.2.161–217.
Scott, Dana (1970). 'Advice on Modal Logic', in Karel Lambert (ed.), Philosophical Problems in Logic: Some Recent Developments, pp. 143–173. D. Reidel.