Necessity compels. In current usage this phrase is usually used to express something that is done unwillingly but with an acceptance that it can't be avoided; for example, I really don't want to cook tonight, but needs must, I suppose.
The phrase is old. In earlier texts it is almost always given in its fuller form - needs must when the devil drives. that is, if the devil is driving you, you have no choice. This dates back to Middle English texts, for example Assembly of Gods, circa 1500:
"He must nedys go that the deuell dryues."
Shakespeare used the phrase several times; for example, in All's Well That Ends Well, 1601:
Countess: Tell me thy reason why thou wilt marry.
Clown: My poor body, madam, requires it: I am driven on by the flesh; and he must needs go that the devil drives.
The phrase became pared down to needs must during the 20th century and, even in that short form, it is rather archaic-sounding and is fading from popular use. This despite a high-profile appearance on TV in Blackadder II, 1985:
"Needs must when the devil vomits into your kettle."
See other phrases and sayings from Shakespeare.
See also: the List of Proverbs.