I think what it comes down to is that. . .
Jack and Sam are both career military. They've volunteered to live that life. They have agreed to abide by the rules and limitations that life in the military requires.
They know why the rules exist. They know the consequences of breaking them. And believe me, it's not just the possible threat of courts-martial or transfers that keeps them from crossing the line.
Military rules and regulations are not arbitrary. They are fundamental to good military discipline and readiness.
While in my head, I believe Sam and Jack are destined to be together, it just will never happen within the confines of the show. It can't. Not while they are both still at the SGC. To have that happen would be to have Jack and Sam sacrifice the code they have chosen willingly to live by. I for one, would not like to see that happen.
Thank goodness for fan fiction, which doesn't need to conform to the standards of real life. And thank goodness for a team of writers who have managed to give us some really creative episodes so that we get to see what might have happened with Sam and Jack, were their circumstances different (TBFTGOG, PoV, WoO, BtS)
Just my point of view on the whole 'can they or can't they?' discussion. And a BIG THANKS to Rowan, for your knowledgeable insight into the topic of inappropriate professional relationships.
<Climbing off my soapbox>, Arcane. . .