  We report the connection between the stacking order and magnetic properties
of bilayer CrI$_3$ using first-principles calculations. We show that the
stacking order defines the magnetic ground state. By changing the interlayer
stacking order one can tune the interlayer exchange interaction between
antiferromagnetic and ferromagnetic. To measure the predicted
stacking-dependent magnetism, we propose using linear magnetoelectric effect.
Our results not only gives a possible explanation for the observed
antiferromagnetism in bilayer CrI$_3$ but also have direct implications in
heterostructures made of two-dimensional magnets.
