It was often hinted that they both had romantic feelings for each other, but was it ever confirmed if they actually got together?
No, it hasn't been confirmed (officially) and with the cancellation of the SGA film nor is it likely that it ever will be.
That being said, all of the cast and crew interview are operating on the principle that they did end up having a sexual relationship. SG1's Producer (Joseph Malozzi) had this to offer on his blog in 2008;
“But what about SG-1?” some of you will (and have) asked. Why didn’t you ever confirm the Sam/Jack relationship in SG-1 but found the need to confirm the McKay/Keller relationship in Atlantis? Well, two reasons. 1) The Sam/Jack relationship was fraught with complications given that he was her commanding officer. Pursuing any sort of relationship would have been inappropriate for both and would only have really been possible late in the series after Jack’s retirement. Which brings us to – 2) Jack and Sam could have gotten together after Jack’s retirement, but it was never made canon because, quite frankly, it wasn’t my call. Still, despite the lack of official confirmation, it was only natural that they should get together after the events of Threads and, in my mind, they have been together ever since. An attempt to suggest as much in season 4’s Trio unfortunately ended up on the cutting room floor when the episode ran long.
And Amanda Tapping (the actress who plays Samantha Carter) had this to say;
Q. What’s your take on Sam’s and Jack’s relationship? Dating, Engaged, Married?
AT: Sleeping together…once he’s retired. Crazy, mad, passionate love. Way too much sexual tension for it not to pay off. Then, they’ll take it from there. Dating….Fishing….Dating…..
Q. Do you want to see an acknowledgement of their relationship in the next movie? If so, will there be one?
AT: I’d like to see some pay off for all their years together. But, I don’t have any say in that.
It was more than hinted at. In the Groundhog Day episode, Jack hands in his resignation one day and immediately and passionately kisses Sam. In another (the name of which eludes me), Jack and Sam are both questioned about the events of a certain mission, and both are found to be lying about those events. In the end, it turns out that Jack wouldn't leave Carter behind to die (or to somehow later escape on her own) because "he cared for her far more than is appropriate [for his position]", and he lied for that reason.
These are both explicit demonstrations of their love for each other, but as you say, they never actually get together because they can't. O'Neill would lose his career, which is extremely important to him, especially with respect to the work he does in the Stargate program.
I did a bit research and two producers said that in the third movie, Stargate: Revolution (that sadly never has been made) would have shown that they are in fact together.
Q. “Emboldened by your last mailbag, I have one question to ask…and after all these years, I promise it will be my last S/J question ever…had we gotten the 3rd SG-1 movie, would the status of Sam and Jack’s post-Threads relationship have been made clear?”
A. [Joseph Mallozzi]: All I can say to that is that, there’s a dinner scene in the first draft of Stargate: Revolution that made it pretty clear that Jack and Sam were, in fact, together.
Brad Wright also confirmed (in this interview) that in the movie script he was writing there would be scene that would be ...
"...shall we say, romantic?"
In the commentary to the Atlantis epiode "Trio" Ms Gero said that Sam and Jack are in a secret relationship. True it was deleted, but it has to mean something:
And then in the Stargate Atlantis legacy series of books (approved by MGM) that clearly hint that they are secretly in a relationship and the newest book, coming this summer, according to the author shall make that even clearer.
And not to forget the Joseph Mallozzi comment earlier in that discussion.
After learning all this, I think it´s safe to assume that they indeed became a couple, even if it´s still against the Air force regulations, not so sure about that honestly.
Keller: Anyone back home?
Keller: Though so! Spill it.
Carter: Well, it's complicated.
Keller: Show me a relationship that isn't.
Carter: He's in Washington, I'm here.
Keller: Long distance relationship, huh?
Carter: He's gonna retire soon, so who knows.
Keller: Retire, huh? So an older man, eh?
Carter: He's not that much older.
Keller: Let's see; older man, Washington. Is he a Senator? [beat] Somebody famous? [beat] But I know him...
Carter: Probably not.
The PTB confirm that she means Jack.
"One, y'know, which is more of a franchise big thing, is that Carter basically admits that she's having, she's in a relationship with O'Neill"
If you watch the "groundhog day" episode (“Window of Opportunity”) at the end Daniel asks Jack if he ever took advantage of the situation. Jack responds by staring at Carter and smiling, I doubt it was just for that kiss they showed us. They went through probably hundreds of loops and showed clips from a handful. They definitely hooked up in one of the loops far past kissing.