Take the example of a Markov chain with three states $0$, $1$ and $2$, with transition probabilities
![A reducible Markov chain](https://cdn.statically.io/img/i.sstatic.net/WMAtTm.jpg)
This Markov chain has precisely two irreducible components corresponding to the two absorbing states $1$ and $2$. Every distribution $\pi$ with $\pi(1)+\pi(2)=1$ is stationary. But depending on the initial state, the Markov chain will eventually be absorbed to one of the two absorbing states. Therefore, the ergodic averages $(1/n)\sum_{m=0}^{n-1}f(X_m)$ will converge almost surely to a random variable with two possible values $f(1)$ and $f(2)$, and in particular will not converge to a constant unless $f(1)=f(2)$.
In general, if a Markov chain is not irreducible, then it may have $0$, $1$ or more irreducible components, and each of these components may or may not support a stationary distribution. The convergence of the ergodic averages will then depend on whether or not the chain ends up in an irreducible component and whether or not that irreducible component supports a stationary distribution ($\equiv$ is positively recurrent). If $C_i$ is an irreducible component with stationary distribution $\pi_i$, then conditioned on the event that the Markov chain ends up in $C_i$, the ergodic averages will converge almost surely to the mean $\sum_x\pi_i(x)f(x)$.
Just a final remark that for the convergence of the ergodic averages, aperiodicity is irrelevant.