Prison authorities in the north-western town of Vechta said the 18-year-old scaled a 13-foot wall to get to his ex's window.
Prison officials intercepted the man. He refused to climb back down, and the fire service was called to bring him down with a ladder.
It was not clear whether he succeeded in winning back the heart of the young woman, also 18, who had broken up with him by phone.
The man is being investigated for trespassing and unauthorised contact with prisoners.
It was reported that the man was half-naked, having taken off many of his clothes to avoid getting caught on barbed wire.