Yes. This is relatively easy to prove if the coefficients of the polynomial $f$ are all integers. Then, the process of calculating $f(n)$ only involves integers, their multiplication and addition, which are "preserved" modulo any number, as you noted yourself $\mod 2$.
That means
$$i \equiv j \pmod k \Rightarrow f(i) \equiv f(j) \pmod k.$$
Since your sequence $(x_n)$ is periodic with period $k$, $(x_{f(n)})$ is also periodic with period $k$.
If the coefficients of $f$ are all rational numbers, then we can find the least common multiple of the coefficients' denominators, say $q>0$, and write
$$f(n) = \frac{g(n)}{q},$$
where $g(n)$ now has only integer coefficients. We then know that
$$i \equiv j \pmod {qk} \Rightarrow g(i) \equiv g(j) \pmod {qk} \Rightarrow f(i) \equiv f(j) \pmod {k},$$
which proves that $(x_{f(n)})$ has period $qk$.
An example would be $f(n)=\frac{n(n+1)}2$, which starts with $f(1)=1, f(2)=3, f(3)=6, f(4)=10, \ldots$ and then repeats this 2 odd, then 2 even numbers pattern indefinitely. In your example of $(x_n)=(a,b,a,b,\ldots)$ that would mean $(x_{f(n)})=(a,a,b,b,a,a,b,b,\ldots)$.
Now this concludes the proof, as any polynomial $f:\mathbb Z \to \mathbb Z$ must have rational coefficients (not a simple fact, but it can be shown that $n!a_n$ must be an integer if $a_n$ is the leading coefficient of the polynomial and then some induction can made for the next lower coefficients).
I'll also note that the proposition stays true if $(x_n)$ is only periodic after a given index $N$. If $f$ is a constant polynomial, the result is trivial. Otherwise, it must tend to $\infty$ as $n \to \infty$, so after some index $N_0$ the index $f(n)$ will always be in the part where $(x_n)$ is peridic.