I can only speak from the Coast Guard point of view, but realize the other services have similar positions.
If you want to write in the Coast Guard and have contact with the media, you'll want to be a public affairs officer. PAOs do a number of things, so it's not a simple, straight forward "you will write…" You may draft news releases, speak on camera, or write speeches.
There are three general "branches" of public affairs; media relations, community relations and internal communications.
Larger services, such as the Army, Marine Corps, Navy and Air Force will have public affairs offices or public affairs officers for units. The Coast Guard, being much smaller, has collateral duty public affairs officers (meaning they have other duties, and being a PAO is just one of them) and public affairs detachments for larger units, such as a sector, and public affairs offices for districts and areas.
If you want a career in journalism after your service, being a PAO will certainly afford you with ample opportunities to interact with the media. There are even units from each service that work with Hollywood. For the Coast Guard, the Motion Picture Office (MOPIC) falls under the service's Office of Public Affairs, at Coast Guard HQ in Washington, D.C. MOPIC, however, is located in Los Angeles.
To become a fully qualified military public affairs officer, you would attend the Public Affairs Qualification Course (PAQC) at the Defense Information School (DINFOS) at Fort George G. Meade, Md. During the two month course, you will have classes in journalism too.
Of course, to be a public affairs officer, it helps to have some training. The Coast Guard very often sends its junior officers to journalism/communications/public relations graduate schools, so the district or area PAOs have master's degrees in this area.
It's a pretty small, tight community. I'm biased, but I think the public affairs mission is often undervalued, until the #$%@ hits the fan. It's an opportunity to tell the tax payer at home what a good investment the military is.
Now being a public affairs officer may not be exactly what you're looking for, but it is a good start in the direction you hope to go.