But We brought forth many generations [after Moses], and a long time passed on them1. And you [O Prophet] did not dwell among the people of Midian, rehearsing with them Our verses2, but it is We Who sent you as a messenger [and revealed to you their stories].
Footnotes
[1]
So they forgot and neglected the ordinances of Allah over time.
[2]
The Prophet (ﷺ) had no way of knowing these stories except through the revelation from Allah.