Middle English doome, from Old English dom "a law, statute, decree; administration of justice, judgment; justice, equity, righteousness," from Proto-Germanic *domaz (source also of Old Saxon and Old Frisian dom, Old Norse domr, Old High German tuom "judgment, decree," Gothic doms "discernment, distinction"), perhaps from PIE root *dhe- "to set, place, put, do" (source also of Sanskrit dhaman- "law," Greek themis "law," Lithuanian domė "attention").
Originally in a neutral sense but sometimes also "a decision determining fate or fortune, irrevocable destiny." A book of laws in Old English was a dombec. Modern adverse sense of "fate, ruin, destruction" begins early 14c. and is general after c. 1600, from doomsday and the finality of the Christian Judgment. Crack of doom is the last trump, the signal for the dissolution of all things.