Consider the possible situation of my sitting with a keyboard in my lap. This possible situation, or possible state of affairs, happens to be actual as I type these words.
But there are many states of affairs which are possible but not actual, such as the state of affairs of my having lived my life as a billionaire in the Bahamas, never having taken up construction work. Now consider the idea of a collection or array of states of affairs, each in itself possible and together compossible, that is, able to obtain together or be true together. The idea of a possible world is just the idea of a very big collection of states of affairs, as complete an array as is possible. Think of the sum total of all the states of affairs which have been, are and will be included in the entire history of everything that ever exists, welcome to possible world semantics.
Now pause and catch your breath.
This is a possible world- the one which happens to have the special status of being actual. But, as philosophers say, there are many other possible worlds which could have been actual instead. There are possible worlds in which I never touch a keyboard. There are some possible worlds in which I exist and never become a construction worker. So the property of being a construction worker is not one of my essential properties, it is not one of the properties necessary for my existence. I have that property only in some possible worlds, not in all, so we say that I have it contingently or accidentally.
Many of my properties I have contingently. But some I have essentially- in every possible world in which I exist. The property of having a mind, or the related property of being at least potentially conscious, is one of my essential properties. There is no possible world in which I exist utterly devoid of a mind or the potentiality for consciousness.
Actually Christian philosophers today have used the idea of possible worlds to help us get some insight into the attributes and existence of God, for part of what it means to be God is to have the properties of goodness, omnipotence and omniscience, and to have them essentially. Plus any individual who is God has this status in and perfectly throughout every possible world. But in order for this to be true, such an individual must of course exist in every possible world. This is what is known as necessary existence, the pinnacle of divine necessity. Necessary existence is just existence in all possible circumstances, in all possible worlds. A necessarily existent being is a being whose nonexistence is strictly, metaphysically impossible.
I drew heavily from a book by T. V. Morris, “Our Idea of God”
O Lord GOD, thou hast begun to shew thy servant thy greatness, and thy mighty hand: for what God is there in heaven or in earth, that can do according to thy works, and according to thy might?