We can thank the biblical Book of Daniel for this phrase, which means doom or misfortune is about to occur. For example, if two people are discussing the layoffs occurring in their company and one says to the other, "The writing is on the wall for all of us," she means their jobs are likely to be eliminated, too.
In the Book of Daniel, chapter 5, King Belshazzar of Babylon and his court are enjoying a decadent feast, drinking wine from goblets taken from the sacred temple in Jerusalem. Suddenly, a disembodied hand appears and writes these words on a plaster wall: Mene, Mene, Tekel, Upharsin. Terrified, the king brings in the prophet Daniel to interpret what they mean. Daniel tells him God is angry at Belshazzar for worshipping false idols rather than God. (Literally, the words mean "number," "weigh" and "divide" so the implication is that God has weighed or judged Belshazzar and his days are numbered [source: Wilson].) As punishment, his kingdom will be taken away from him and divided. That night the king is murdered and his lands are taken over by an invading tribe.