The traditional appeal of military service, anchored in notions of patriotism and duty, now competes with a changing job market and a new generation’s redefined sense of purpose.