We existed as intelligences before coming to earth. In the pre-mortal life, we progressed as far as possible without physical bodies. God presented a plan for us to gain physical bodies and experience mortality through Jesus Christ. However, Lucifer rebelled and wanted God's power instead. This led to a war in heaven where Lucifer and his followers were cast out. Those who accepted God's plan then came to earth to experience mortality and be tested.