That happened in the first episode of 'Torchwood' ("Everything Changes").
For the TV series, it was probably a throw-away line; we may never see onscreen how that could have happened. But it may show up someday in a tie-in novel, perhaps even in a future episode. Before the premiere night was over, there were probably fanwanks pounding away at their keyboards to come up with their own fanfic to splain how it came to be that a man got pregnant.
I'm more curious as to what happened afterwards.....
In "Something Borrowed" from the second season, we got to meet an old buddy of Rhys Williams by the name of "Banana Boat". Something of a dork, but then what would you expect from somebody still going around with a nickname like "Banana Boat"? (Kind of like "Boner" Stabone from 'Family Ties', and let's face it, much as we love him, "Beaver" Cleaver.)
When I saw Jonathan Lewis Owen, the actor playing Banana Boat, the first thing I thought was - "They cast this guy in the wrong 'Torchwood' role."
This season we learned that in the 52nd Century, Jack had a younger brother named Grey, whom he thought was lost forever. But then in the second season premiere, his old partner John Hart told him that he had seen Grey. So it's possible that in some future time-line, Grey is still alive.
But we don't know at what age he is/was/will be when John saw him.
Take a look at this picture of Jonathan Lewis Owen, the guy who played Banana Boat, compared to John Barrowman who plays Captain Jack Harkness.Given the variables of the genetic mix 'n' match, don't you think it's possible that he could have played the adult version of Grey, Jack's brother? Or am I the only one who sees the similarities?
Of course, as it was established in "Kiss, Kiss, Bang Bang" that John Hart saw Grey, we're O'Bviously destined to revisit that storyline. So there's no use in speculating what might have been as far as that casting goes. Like I said, we don't even know what age Grey will be when Jack is reunited with him.
But there's still another route we can take, and Jonathan Lewis Owen's portrayal of Banana Boat doesn't have to negate it... just yet.
Here's the theory: Banana Boat is descended from Captain Jack. And it could be as close a genetic link as Jack being his Mommy!
Again, that would all depend on if the storyline about Jack'spregnancy is ever revealed. For all we know, what with this show's penchant for downer endings, Jack's pregnancy never came to term. And it also depends on when in Jack's personal timeline this pregnancy happened. If it happened while he was serving as a Time Agent, it could be at any point in the Toobworld timeline, and anywhere in the galaxy.
I wouldn't be surprised to find out that he got knocked up during those missing two years of his memory, and he still doesn't know how it happened; just that he gave birth once he remembered who he was.
Otherwise, it could have happened at any point after his transformation into The Man Who Couldn't Die, once he returned to Earth in 1869. (? - Check this date.) And if so, the farther back the better for making a claim that Jack was the founder of Banana Boat's family tree. Without either one of them realizing it, Banana Boat may have met his "great-grandmother" Jack; and neither of them would ever have to realize it.
And even if it turns out that Jack's pregnancy was a dead end, and he lost the baby, he still did a lot of what the Doctor would have called "dancing" over the next hundred years and more. Eventually he could have fathered instead of mothered someone in Banana Boat's family tree.
One last point: it looks like Jack Harkness will sometime in the future transform into the Face of Boe. And in 'The Long Game', it was reported that the Face of Boe was pregnant.
So much for Jack's boast that he would never get pregnant again.