In current political discussions, this phrase refers to people’s efforts to pay all their bills with inadequate funds. World Wide Words says the exact origin is unknown.
The oldest example I can find is from Thomas Fuller’s The History of the Worthies of England of about 1661: “Worldly wealth he cared not for, desiring only to make both ends meet; and as for that little that lapped over he gave it to pious uses”, but the fact that Fuller is making a little joke using it suggests he already knew of it as a set phrase.
One suggested origin refers to columns of bookkeeping numbers where credits and debits must match, or where end-of-year numbers must balance. Another suggestion is the phrase refers to having enough fabric to complete a dress.
English Language and Usage adds the possibility that the phrase comes from ropes on a sailing ship or wearing a belt that is too short, but without any references it’s speculation.