For countries, they were "forced" to join the conflict due to their alliance and promise to come to military support when war breaks out.
For colonies, they were "forced" to join as they were conscripted to join into their host country's military.
This was essentially why Germany, Great Britain, and Russian Empire, tried to call for a peaceful settlement between the Austrio-Hungarian Empire and Serbia, but, on failing, were forced to join the war.