The map belonged to one of the Marauders. The Weasley twins were not related to any of them.
How come they inherited the map?
George and Fred Weasley stole it from Argus Filch's storage cabinet of confiscated items when they'd been brought in by him for misbehaving. Filch presumably confiscated it from another student, but I don't know that it is ever confirmed from whom he confiscated the map.
From Harry Potter and the Prisoner of Azkaban:
“Well . . . when we were in our first year, Harry — young, carefree, and innocent —”
Harry snorted. He doubted whether Fred and George had ever been innocent.
“— well, more innocent than we are now — we got into a spot of bother with Filch.”
“We let off a Dungbomb in the corridor and it upset him for some reason —”
“So he hauled us off to his office and started threatening us with the usual —”
“— detention —”
“— disembowelment —”
“— and we couldn’t help noticing a drawer in one of his filing cabinets marked Confiscated and Highly Dangerous.”
“Don’t tell me —” said Harry, starting to grin.
“Well, what would you’ve done?” said Fred. “George caused a diversion by dropping another Dungbomb, I whipped the drawer open, and grabbed — this.”
“It’s not as bad as it sounds, you know,” said George. “We don’t reckon Filch ever found out how to work it. He probably suspected what it was, though, or he wouldn’t have confiscated it.