“Lost in Time”
Beaker accidentally gives Fozzie a time-travel hat, which takes him back through time to meet various ancestors (who also all tell bad jokes). Kermit and the other Muppets get time-travel hats of their own to find Fozzie and bring him back.