You can apply for student housing as soon as you have received a study place. In the larger cities it may take several weeks or months before you receive student housing.
If you are granted student housing, you can usually live there throughout your studies. You must, however, be a fulltime student and make progress in your studies. Your lessor may terminate your tenancy agreement if you have not completed enough courses.
If you are covered by Finnish social security, you can apply for a housing allowance from Kela to cover your housing costs. Read more about the housing allowance on the InfoFinland page Housing allowance.