I was told that the religion of Islam was explained to the souls of the people before coming down to Earth. Do you mind elaborating more on this topic or providing me with some resources about it?

Basically before we were born, in the world of souls, God made a covenant with us and revealed His existence to us. Our trial in this worldly, materialistic life is to stay true to that covenant.

You may see this lecture for further details: