Labour's Clive Lewis, who is standing in Norwich South, made the comment in an interview with the New Statesman.
He had been asked if he was taking victory in the marginal seat for granted.
He said he was "sincerely sorry" if anyone had been offended by the comment.
Mr Lewis, who worked for BBC Look East as a reporter, had told the magazine: "I mean, in the multiverse there's still three universes in a hundred where there's a Green MP in Norwich, so anything could happen.
"I could be caught with my pants down behind a goat with Ed Miliband at the other end - well, hopefully that won't happen."
In 2010, Labour's Charles Clarke lost the seat to the Liberal Democrats' Simon Wright who had a majority of 310 votes.
Regarding his New Statesman interview, Mr Lewis said: "On occasion we all have the ability to get carried away with language and colourful metaphors.
"If anyone was genuinely offended then I'm sincerely sorry for that."
Mr Lewis is standing against independent Cengiz Ceker, UKIP's Stephen Emmens, Lesley Grahame from the Green Party, David Peel of Class War, Conservative Lisa Townsend and Liberal Democrat Simon Wright.
An election candidate has apologised for joking that he "could be caught with my pants down behind a goat with Ed Miliband at the other end".