Ancient texts should be considered as a philosophy rather than science, because almost nothing was formally proved that time, but lots of phenomena were correctly inferred or guessed.
Most famous insights, of course, were these about the nature of mind from the Upanishads, which uses state of sleep, deep-sleep (without dreams) and wakefulness as metaphors to illustrate what we now call "models of the world", "contexts", "cognitive dissonance", "frames of reference", or just the role of the mind (consciousness) in cognition - how we constantly distort, reinterpret and even ignore perceived reality.
Roughly, it was a notion clarified later by Buddha - "Life is shaped by our mind, we become what we think", the notion that all our (at least psychological) "suffering" begins (and ends) inside our skulls and doesn't exist in the world outside.
Another great notion was one of the Dzongchen sect of Tibetan Bon tradition, when they use analogy of a mirror to how our mind should "work" - as a mirror isn't affected by what it reflects, so the mind in its "primordial" (original, such that of a child) state is just a "tool" to "do everything", including things done by Buddha or Einstein.
More recent marvels from India including "Want to see a God - look between two thoughts" by "modern" saint Ramakrishna, which is "in continuum" back to Upanishads.
In short, in decent texts composed by highly intelligent authors (including so-called fiction) there is a possibility to find correct inferences and guesses for almost every observable phenomena, if your own mind is lucid enough.