Moses held out his arm toward the sky and thick darkness descended upon all the land of Egypt for three days.
There were 2 main reasons for the plague of darkness.
To hide from the Egyptians the fact that many Jews, who were unworthy of being freed, died during this plague. We are told that 4/5th of the Jewish population died, which was roughly 12 million Jews. (It is interesting to note that there were 4 times the number of women than men in Egypt)
To allow the Jews, who were unaffected by the plague of darkness, to roam freely within the Egyptians’ homes and locate their valuables, which they would later ask to “borrow.” The Egyptians were deeply impressed that the Jews didn’t take advantage of the plague to loot them.