it depends... In my case I could ask for a letter of recommendation any time I wanted, because my school has a pre-health committee that saves all my letters and then puts them all together when PharmCAS opens up (the process is WAY more complicated...) But If your school does not have something like this, the best thing you can do is just pass by the professor's office and let him/her know you will need a letter of recommendation in the future (its always nice if you pass by his office from time to time after that so that he/she won't forget you).