When the Kingdom of Yugoslavia entered World War II due to the Axis invasion of the country in April 1941, Ekmečić remained in the Čapljina area until 1943. During the invasion, the Independent State of Croatia, a fascist puppet state, was established; the new state encompassed Čapljina. On 6 August 1941, the ruling Ustaše perpetrated the Prebilovci massacre, in which Ekmečić lost 78 members of his family, including his father and uncle. The surviving members of his family formed a unit of the Yugoslav Partisans resistance movement in Prebilovci. From October 1944 until July 1945, Ekmečić was a member of the Yugoslav Partisans.