Footnote: I originally asked this on math.SE but it was recommended that I ask here on hsm.SE.
The answer depends on how much of "formalization" counts, and of what exactly. Asghari's Equivalence: an attempt at a history of the idea gives a detailed account of the genesis. Implicit use goes back to Euclid and before him, Dedekind cuts are more explicit. But outside of specific contexts we need to go all the way to the beginning of 20th century. Equivalence relations under another name are defined in Jourdain's paper (1912), "equivalence relations" with defined classes that are not named "equivalence classes" - in Hasse's Höhere Algebra (1926), and both together - in the third edition of Birkhoff's Lattice Theory (1948):
"I call a relation which is reflexive, symmetrical, and transitive an isoid relation. Jourdain (1912) presented his article On isoid relations and theories of irrational number to the Fifth International Congress of Mathematics, starting with the sentence above. At the time, the process of “definition by abstraction” (Russell 1903, pp. 219-220) was quite well established but the term “equivalence” was mainly attached to the context of cardinal numbers."
"Jourdain was one of the first who suggested a decontextualized term for what we now know as “equivalence relation”. However, he was not successful at popularizing the term. Even Russell, one of his closest correspondences, refers to such relations with no name and only qualify them as an “important kind of relation”, noting that, “similarity is one of this kind of relations” (Russell 1919, p. 16). By 1919, neither the combination “equivalence relation” nor “equivalence class”was in use. The necessity of naming was first felt with the relation, not with the classes that are formed by that relation... Hasse (1926) wrote:"We call such a decomposition a partition of M,and the subsets thereby determined its classes."
"Interestingly it seems that “equivalence class” was enjoying a path of its own for a long time. Von Neumann (1926,1929), Hopf (1930), and Seifert and Threlfall (1934) used the term “Äquivalenzklasse”, Von Neumann (1936) “equivalence-class” (with a hyphen) and Solomon Lefschetz (1938,1942) “equivalence class” (without a hyphen). The terminology was for denoting the classes constructed by certain contextualized equivalences, none of which was referred to as an “equivalence relation”..."
"The third edition [of Birkhoff's Lattice Theory] is a typical example of what we observe in the texts written by mathematicians for mathematicians after 1950. Before 1950, we might find all different sorts of the use of terminology: no mention at all (e.g. Russell 1903), alternative terms (e.g. Jourdain 1912; Carnap 1928), only “equivalence relation” with no mention of the term “equivalence class” (e.g. Weyl 1949) or an alternative (e.g. Birkhoff 1935). Generally, the combination “equivalence class” became common much later than the “equivalence relation” while closer to 1950 we can observe clear uses of both combinations alongside each other."