The modified gravity is considered to be one of possible explanations of the accelerated expansions of the present and the early universe. We study effects of the modified gravity on big bang nucleosynthesis (BBN). If effects of the modified gravity are significant during the BBN epoch, they should be observed as changes of primordial light element abundances. We assume a $f(G)$ term with the Gauss-Bonnet term $G$, during the BBN epoch. A power-law relation of $df/dG propto t^p$ where $t$ is the cosmic time was assumed for the function $f(G)$ as an example case. We solve time evolutions of physical variables during BBN in the $f(G)$ gravity model numerically, and analyzed calculated results. It is found that a proper solution for the cosmic expansion rate can be lost in some parameter region. In addition, we show that calculated results of primordial light element abundances can be significantly different from observational data. Especially, observational limits on primordial D abundance leads to the strongest constraint on the $f(G)$ gravity. We then derive constraints on parameters of the $f(G)$ gravity taking into account the existence of the solution of expansion rate and final light element abundances.