An entire function $f$ for which $f(x + n i) \in i \mathbb{R}$ for all $x \in \mathbb{R}$ and $n \in \mathbb{Z}$ is necessarily periodic with period $2 i$. This follows from Schwarz' reflection principle.
Let $g_n(z) = i \, f(z + n i)$ then $g_n(\mathbb{R}) \subseteq \mathbb{R}$ and according to this principle $g_n(\overline{z}) = \overline{g_n(z)}$ for all $z \in \mathbb{C}$. For $n=0$ this shows that
$ f(\overline{z}) = -\overline{f(z)} $
and for $n=1$ that
$ f(\overline{z - i}) = f(\overline{z} + i) = -\overline{f(z + i)}. $
Combining these equalities we get
$ \overline{f(z + i)} = -f(\overline{z - i}) = \overline{f(z - i)} $
and after substituting $z \leftarrow z + i$ and conjugation
$ f(z + 2 i) = f(z). $.