Or, let it be admitted, from other sweet juices -- beet, sorghum, maple syrup, and so on. It's a product of a step in the process of refining sugar -- the next being to crystallize out the sugar, resulting in brown sugar. It can be used in cooking as a sweetener and to provide a distinctive flavor -- though note that in the UK and some Commonwealth countries, molasses for human consumption is instead called treacle. It's been a word in English since the 1570s, adopted from either Portuguese melaço or French mélasse, both from Late Latin mellāceus, honeylike/honey-sweet, from Latin mel, honey.
"As slow as molasses in January" dates to when the stuff was kept in barrels in unheated locations -- it can get v-e-r-y s--l--o--w p---o---u---r---i---n---g.