The Last Full Measure by Michael A. Martin
Without warning or provocation an alien weapon appears above Earth and unleashes a blast that kills millions across two continents. A second such weapon could destroy the entire planet. In a desperate bid to save Earth and its people, Starfleet must change its mission from one of peaceful exploration to one of military service. Only the Starship Enterprise is fast enought to stop the production of a second Xindi weapon. But the crew cannot do it alone, and Captain Jonathan Archer accepts a contingent of Military Assault Command Operations personnel - battle-hardened soldiers known as MACOs - on board his ship. Starfleet and the MACOs are two very different services sharing a common goal, but divided in their views of how to attain it. It is a culture clash that echoes across centuries of military service. The men and women on board the Enterprise understand that somehow they must succeed in working together or the price will be paid in blood - failure is not an option.