Jack can't date Sam because he is her commanding officer. He gives her orders and does her job evaluations. They aren't equals, he has a tremendous amount of power over her. If he were to ask her out, it would be a serious breach of ethics, no different than a teacher sleeping with a student, or a psychiatrist getting involved with a patient. More than a few military personnel have been court-martialed because they violated the regulations, some have even gone to jail.
However, considering that the only thing keeping them apart is that neither one wants to make some changes to his/her career path, it's hard to feel too sorry for them. You'd think if they were really so much in love Sam would transfer to another team or Jack would retire for the 3rd time. The only obstacle in their path is themselves.