The notion of a matrix appeared far ahead of that of a vector space. So when did people start considering a matrix as a linear transformation between two vector spaces?
The notion of a matrix did not appear ahead of the notion of a linear transformation by that far. Although matrices feature implicitly in Cramer’s work on determinants (1750), and Euler’s (1760) and Cauchy’s (1829) work on quadratic forms, Sylvester only introduced the term "matrix" to denote an array of numbers in 1850. He did not do much with them, but Cayley developed a theory of them starting in 1857, when he discovered that each matrix satisfies equation of its own order and defined "characteristic values". See more in Motivation behind Euler Theorem in differential geometry.
The concept of linear transformations appears implicitly at around the same time in Grassman’s Ausdehnungslehre (1844), and especially in Hamilton’s work on quaternions (1845-), which made extensive use of quaternions’ ability to represent rotations in space. In 1875 Darboux gave the first axiomatization of vector spaces, quite different looking from the modern one, he was motivated by representing forces in statics. And in 1888 Peano gave an axiomatization that was essentially modern, but like Sylvester he did little with it, and few paid attention to it. Nonetheless, "Peano did see Carvallo's linear systems (i.e., matrices) as instances of his own linear systems, without explicitly stating that square matrices of fixed order were an example of a vector space" according to Moore’s Axiomatization of Linear Algebra: 1875-1940.
One of the few was Pincherle, who in 1901 published a book about operators on what he called linear sets or linear spaces, focusing on infinite-dimensional ones like spaces of analytic functions. Another was Burali-Forti, who applied vector spaces in projective geometry in 1896, and then in vector calculus in 1910. In 1912 he published a book Transformations Lineaires, co-authored with Marcolongo, which opens with:“We briefly set forth the foundations of the general theory of linear systems and linear operators. Generally, these matters are familiar in large part”.
It is tempting to say that people started viewing matrices as linear transformations from that point on, but history is rarely so straightforward. As Moore writes, “although this general notion [of vector space] was first formulated by Peano in a geometric context in 1888, it remained almost unknown at the time. Three decades later it was rediscovered independently in two quite distinct branches of mathematics: functional analysis and ring theory. In ring theory, its roots were in Dedekind's work on algebraic number theory… The period in question can be considered to end with the publication in 1941 of A Survey of Modern Algebra by the young algebraists Garrett Birkhoff and Saunders Mac Lane, who were then at Harvard”.
The first branch was deeply influenced by von Neumann's Mathematical Foundations of Quantum Mechanics (1932) that formalized the subject in terms of Hilbert spaces and self-adjoint operators, and the Polish school of functional analysis. Banach's Théorie des Opérations Linéaires also came out in 1932, and his point was that it is much more efficient to prove a result once about all vector spaces than to prove it repeatedly for 10 different function spaces. The second branch owes its rediscovery to the work of Emmy Noether and van der Waerden in 1920s, which culminated in der Waerden's highly influential two volume Modern Algebra (1930,31). A new generation of algebraists was raised on it, and it featured vector spaces and linear transformations among many other innovations, see more in What was the evolution of "basis" and "generating set" in algebra?
This happened gradually, one cannot pinpoint a precise moment. Probably the most important step in this respect was publication of the first volume of Hilbert Courant, Methods of Mathematical Physics in 1924. Until the invention of quantum mechanics, few people have heard of matrices. But after that, all started reading Hilbert Courant, and gradually this point of view prevailed.