Does the Markov inequality also work for infinite $a$ or only for constant $a$?
More precisely: If $X(n)$ is a sequence of random variables and $f(n)$ is some sequence of numbers,is it allowed to apply Markov inequality for $X(n)$ and $f(n)$ even though I know that $f(n) \rightarrow \infty$?
The more precise part makes perfect sense: sure, for every $n$ you can apply Markov's inequality to $X(n)$ and $f(n)$ (assuming $X(n)$ is nonnegative), obtaining $$\mathbb P(X(n)\ge f(n))\le \frac{\mathbb E(X(n))}{f(n)}$$
The first sentence of your question is meaningless. Applying some operation to every term in a sequence of numbers than tends to $\infty$ is not the same as applying the operation to $\infty$. The latter is often undefined.