It now means some lengthy and complicated procedure but an older sense was of a complicated and incoherent set of statements or a wandering discourse — I shall try to avoid any such tedious tale, but the history of this word is more than a little odd and takes some recounting.
In medieval times, there was a game called ragman, which seems to have been like consequences but with predefined statements. It used a rolled-up scroll containing descriptions of characters, each with a string attached. Players selected a string at random, the scroll was then unrolled and the associated passage read out, to the hilarity of all present (these were simpler times). There are also some suspicions that the same system was used for a gambling game.
The origin of the name for the game is obscure: the oldest form was rageman, said as three syllables, and this suggests it may have been French in origin — a character called Rageman the Good appeared in some French verses of about 1290. Others think it might have come from rag in the sense of tatters, used as a name for a devil (as in ragamuffin, originally a demon).
The name was transferred to various English statutes at the end of the thirteenth century, which were written on scrolls. With the seals and ribbons of their signers sticking out, these reminded people of the scroll used in the game. The most famous such document was the one in 1291 in which the Scottish nobility and gentry subscribed allegiance to Edward I before John Balliol took the Scots throne.
It seems the terms ragman and ragman roll passed into the language as a description of a long and rambling discourse, no doubt from the disconnected nature of documents like the rolls of allegiance. It later seems to have fallen out of use; it reappeared in the eighteenth century in various spellings, such as riggmon-rowle, but it eventually settled down as rigmarole, in the process losing any clear connection with the older term.