You can take it anytime it is offered during the year. At the latest, you can take it during the quarter before the quarter where you plan to take a foreign language class.
Also, you can only take it once -- there are no retakes. So you're set in the level into which you placed.
However, if you're planning to take a completely new language, I don't think you have to take a placement test for it.