Good old Google. I found this, which helps, in Quinion.
I still couldn't explain it to somebody else.

NEEDS MUST WHEN THE DEVIL DRIVES
[Q] From Jonathan Harpaz, Israel: “Does the following expression/idiom exist: needs must when the devil drives? If so, is it British or American and when did it originate?”
[A] The expression does exist, and as it happens is one of the older proverbs in the language, somewhat predating the USA. Shakespeare uses it in All’s Well that Ends Well: “My poor body, madam, requires it: I am driven on by the flesh; and he must needs go that the devil drives”. However, it is actually older—the earliest I can find is in John Lydgate’s Assembly of Gods, written about 1420: “He must nedys go that the deuell dryves”.
The form you quote is the usual modern one, but it isn’t so easy to understand, as it is abbreviated and includes needs must, which is an semi-archaic fixed phrase meaning “necessity compels”. The Shakespearean wording makes the meaning clearer: if the devil drives you, you have no choice but to go, or in other words, sometimes events compel you to do something you would much rather not.