At the end of the 'great tribulation' Jesus said there will be signs in the heavens. The sun, moon and stars will all be affected. Some suggest that this sign is a description of a spiritual shake up in the heavenlies, a shake up that describes the doom of satan and his demonic hoard, and the resulting fall of his kingdom. This may be supported by the phrase, "and the powers of the heavens will be shaken". And for certain, these events do mark an end to the dark rule of the evil one.
However, before diverting to a spiritual meaning to the text, it is always best to interpret it in its plain meaning, that being the dimming of the celestrial sources of light turning the earth's surface dark. In the context of the next passage, the coming of the LORD with "great glory", a darkened world would be the ideal back drop to the glorious appearance of Christ! It is possible that both interpretations are correct.
In this prophecy, Jesus quotes the Old Testament prophecy of Joel which ushers in the 'great and awesome day of the Lord'.
Joel 2:31 "The sun will be turned into darkness And the moon into blood Before the great and awesome day of the LORD comes."
Read other Old Testament prophets' descriptions the 'day of the LORD'.