At the beginning of World War I, Vileišis co-founded a Lithuanian organization aimed at helping war victims with agronomic and legal support, and became its chairman. He was also an active member of the Lithuanian Committee. Six schools were established by Vileišis in the Alanta district. As a member of the Lithuanian Science Society he organized the publication of school textbooks. For distributing anti-German fliers among teachers, he was jailed in the Lukiškės Prison for six months and later to Germany for forced labor. In Berlin he managed to escape from prison, and he went into hiding until he was given permission to return to Lithuania.