Here is a brief summary of the official view of Jehovah’s Witnesses and joining the military:
"Jesus’ disciples obey his command to be “no part of the world” by remaining strictly neutral in political matters. (John 17:16) They do not protest against military actions or interfere with those who choose to serve in the armed forces.” (Frequently Asked Questions)
https://www.jw.org/en/jehovahs-witnesses/faq/why-dont-you-go-to-war/ https://www.jw.org/en/jehovahs-witnesses/faq/political-neutrality/
"Christians chose to remain politically neutral. No injustice or threat to them or the country in which they lived justified taking part in military action.” (Watchtower October 2009) https://www.jw.org/en/publications/magazines/wp20091001/Is-War-Compatible-With-Christianity/
Would a baptised Jehovah’s Witness who joined the military and who was unrepentant be expelled from the congregation? This is the only guidance to be found in literature available to the public:
"Two factors—which must coincide—result in the disfellowshipping of one of Jehovah’s Witnesses. First, a baptized Witness commits a serious sin. Second, he does not repent of his sin." Source: 15 April 2015 Watchtower article on disfellowshipping baptized members
"If, however, a baptized Witness makes a practice of breaking the Bible’s moral code and does not repent, he or she will be shunned or disfellowshipped. The Bible clearly states: “Remove the wicked man from among yourselves.”—1 Corinthians 5:13.” https://www.jw.org/en/jehovahs-witnesses/faq/shunning/
Although the official line is that they
"do not interfere with those who choose to serve in the armed forces”
that does not apply to baptized Witnesses. Taking up arms, going to war and taking life would be considered a serious sin.
Baptized Witnesses can be disfellowshipped for failing to repent from any serious sin that involves disobeying the Governing Body and the elders – even for speaking out against or challenging or questioning the authority of their leaders. Because the organization literature does not specifically state that joining the military is a serious sin does not mean to say it would result in being expelled (and then shunned). Another example would be if a baptized Witness accepted a blood transfusion and was unrepentant. Nowhere in the literature does it say that person would be disfellowshipped. All that is now said is that it is a matter of personal conscience. The reality, however, is different.
https://www.jw.org/en/search/?q=grounds+for+disfellowshipping
https://www.jw.org/en/publications/magazines/w20150415/disfellowshipping-a-loving-provision/
https://www.jw.org/en/publications/magazines/w20061115/accept-jehovahs-discipline/
Additional information: Shepherd the Flock of God (2011) Elder’s Manual - Disfellowship Offences include:
No 2 – Apostasy which includes rebellion against Jehovah’s organization – Watchtower 63 7/1
No 19 – Non-neutral activities (involvement in politics and the military) – Pay Attention to Yourselves and to All the Flock (ks91-E) p.96
No 20 – Military service and non-military service including working casual work (certain civilian work has recently been made a conscience matter Watchtower 96 5/1 p.20) – Pay Attention to Yourselves and to All the Flock (ks91-E) p.96
No 17 – Loose conduct which includes disrespect to elders or contempt in a judicial meeting - ks91-E pp.93, 96, w83 3/15 p.31, w73 9/15 p.574, it-2 p.264, ks91-E p.93, w83 3/15 p.31, w73 9/15 pp.574-6, w97 9/1 p.14, it-2 p.246.