In life, we take risks to achieve and maintain values. Objectivism
holds that you should choose a course in life that will be conducive to your survival and happiness, and that ultimately your own well-being as a rational man should be the standard by which you determine what you should do, in the broadest sense. (Within that realm, your own personal values will be key for you, of course.) I think it is hard to find a course in life that does not involve some risk of death, and serving in the military is much like other courses in this regard. (I don't know whether this is true, but I wouldn't be surprised to learn that since the Vietnam War ended, truck driving as a profession had worse mortality statistics than military service). You may find this laughable, but consider: I drive six or more hours a week on highways in all weather to do my job, fighting for cultural change. It certainly has raised my risk of dying for my job. So in some sense I face a dilemma not unlike yours.
But, the difference of degree is substantial. The business of the soldier or sailor is to be ready to put himself in grave danger, suffer wounds, even die if need be to achieve his unit's (and his country's) goals in war. How can Objectivism, which advocates putting one's own life above all other values, accept such a principle?
Since the difference of military service from other occupations is of degree, the values that one seeks to achieve and defend by it must be substantial. Defending one's own liberty is obviously one such value, since without liberty, life is usually short, chancy, and unpleasant at best. But defending the liberty of the alliance of free countries is also a great value. Americans have a choice: We can risk no soldier or sailor's life on foreign soil, and wait for war and tyranny to come to our shores, or we can risk lives to defend a system of freedom in the world that has brought peace where there were terrible wars, and prosperity where there was poverty and stagnation. Peace and prosperity, and freedom to trade and travel, are what makes rational life possible, what makes it possible to advance our own lifespans and enhance the quality of life that we live. It makes possible more products and a better standard of living. Objectivism
holds that self-sacrifice itself is ignoble. But these are values worth defending, and the only way to defend them is with a credible and competent military. This is a great system: As the loose alliance of free (democratic and market-based) countries grows, the military power of the U.S. ensures its survival. Perhaps this will bring a day when a major war is extremely unlikely to occur.
In your case, I don't think it fair to say you have made a commitment to die for Taiwan or some other distant locale as such. You have made a commitment to defend the world system of liberty, at some risk to your own life. To be effective as a sailor, you must develop in yourself the commitment to act even in situations where your life is in grave danger; that is how military victory is achieved. You have had to develop the commitment to put the survival of your ship or unit first in a crisis. But this is just how a soldier or sailor must act, if his unit is to be effective and if he is to avoid war or be likely to survive one. To develop these commitments, in the proper context of serving one's own life and values, is simply integrity.
The great adversaries of the United States in the past century have largely been countries that ran their military on sacrificial lines. But the U.S. military has largely been careful with its members' lives (at least that’s how, for example, the Germans and the Japanese saw it). This just emphasizes the point I made above, that the purpose of an effective military is to win battles and wars, not get its soldiers and sailors killed.
So, in sum, I don't think, on the Objectivist account of value and virtue, there is anything wrong with reasonably risking one's life to defend liberty, either at home or abroad. I would say, however, that the U.S. government's record has been mixed, and at times the military has been asked (and is still asked) to undertake projects at odds with liberty. To some degree there is a recognition in American law that some orders from superiors are not to be followed, and not all military causes are just. So I would think that if there is an ethical concern in military service for an Objectivist, it concerns two issues: 1) Is the risk to life reasonable for the goals concerned? 2) What is one's service aimed at? If liberty, here and abroad, then at least in the current situation that seems well worth defending. If not liberty, then serious doubts should arise.