The idea of a unified spacetime is stated by Edgar Allan Poe in his essay on cosmology titled Eureka (1848) that "Space and duration are one". In 1895, in his novel The Time Machine, H. G. Wells wrote, "There is no difference between time and any of the three dimensions of space except that our consciousness moves along it", and that "any real body must have extension in four directions: it must have Length, Breadth, Thickness, and Duration".
Marcel Proust, in his novel Swann's Way (published 1913), describes the village church of his childhood's Combray as "a building which occupied, so to speak, four dimensions of space—the name of the fourth being Time".
The first reference to spacetime as a mathematical concept was in 1754 by Jean le Rond d'Alembert in the article Dimension in Encyclopedie. Another early venture was by Joseph Louis Lagrange in his Theory of Analytic Functions (1797, 1813). He said, "One may view mechanics as a geometry of four dimensions, and mechanical analysis as an extension of geometric analysis".
After his discovery of quaternions, William Rowan Hamilton commented, "Time is said to have only one dimension, and space to have three dimensions...The mathematical quaternion partakes of both these elements; in technical language it may be said to be 'time plus space', or 'space plus time': and in this sense it has, or at least involves a reference to, four dimensions. And how the One of Time, of Space the Three, Might in the Chain of Symbols girdled be". Hamilton's biquaternions, which have algebraic properties sufficient to model spacetime and its symmetry, were in play for more than a half-century before formal relativity. For instance, William Kingdon Clifford noted their relevance.
Another important antecedent to spacetime was the work of James Clerk Maxwell as he used partial differential equations to develop electrodynamics with the four parameters. Lorentz discovered some invariances of Maxwell's equations late in the 19th century which were to become the basis of Albert Einstein's theory of special relativity. Fiction authors were also involved, as mentioned above. It has always been the case that time and space are measured using real numbers, and the suggestion that the dimensions of space and time are comparable could have been raised by the first people to have formalized physics, but ultimately, the contradictions between Maxwell's laws and Galilean relativity had to come to a head with the realization of the import of finitude of the speed of light.
While spacetime can be viewed as a consequence of Einstein's 1905 theory of special relativity, it was first explicitly proposed mathematically by one of his teachers, the mathematician Hermann Minkowski, in a 1908 essay building on and extending Einstein's work. His concept of Minkowski space is the earliest treatment of space and time as two aspects of a unified whole, the essence of special relativity. (For an English translation of Minkowski's article, see Lorentz et al. 1952.) The 1926 thirteenth edition of the Encyclopædia Britannica included an article by Einstein titled "Space–Time".) The idea of Minkowski space led to special relativity being viewed in a more geometrical way.
However, the most important contribution of Minkowski's geometric viewpoint of spacetime turned out to be in Einstein's later development of general relativity, since the correct description of the effect of gravitation on space and time was found to be most easily visualized as a "warp" or stretching in the geometrical fabric of space and time, in a smooth and continuous way that changed smoothly from point-to-point along the spacetime fabric.