It's obviously not due to lack of talent. It's important to ask first whether the ancients even aspired to photorealistic paintings. Consider that the ancients were adept at a form of artistic representation that was even more "realistic" than a photorealistic painting: sculpture. Even the Egyptians, famous for their stylized two-dimensional art, where quite capable of realistic sculpture. This bust of Nefertiti is from 1345 BC:

There's more here. And of course, ancient Greek sculptures had even greater verisimilitude. 2D art can never be as representative of 3D space as 3D art can, so it is not surprising that 3D art has long had a more realist bias than 2D art.
In two-dimensional art, artists generally privileged thematic and spiritual considerations over realism. According to the article on perspective, they "typically sized many objects and characters hierarchically according to their spiritual or thematic importance, not their distance from the viewer
That said, perspective in 2D art is not intuitive, and the development of perspective required grounding in mathematics. While the ancient Greeks (who were quite good at math) did begin to develop some understanding of perspective, modern theories of perspective did not really start developing until the 15th century. Brunelleschi is an especially important figure here. Within two centuries of the development of perspective, we have artists like Vermeer who are noted for their "almost photorealistic" style.
Still, you are correct that not even early modern artists were as obsessed with "photorealism" as members of the modern photorealist movement. The photorealism movement, from its chosen name to its chosen style, was a reaction to the ubiquity of photography in the 20th century:
Pop Art and Photorealism were both reactionary movements stemming from
the ever increasing and overwhelming abundance of photographic media,
which by the mid 20th century had grown into such a massive phenomenon
that it was threatening to lessen the value of imagery in
art. However, whereas the Pop artists were primarily
pointing out the absurdity of much of the imagery (especially in
commercial usage), the Photorealists were trying to reclaim and exalt
the value of an image.
The photorealists are clearly not, to a man, more talented than Vermeer and others like him. They are simply using their art to convey a message that no artist before the modern era would ever have needed or wanted to convey.