The phrase came from the ancient Romans where as a woman would wear a girdle that would be tied in a knot. Before the marriage would be official, the groom would have to untie the knot.
yes it was once literal. in old times the priest would take a rope and wrap it around the bride and groom's hands and tie it in a knot. these days they use a ribbon.