This is a complicated question with no fixed answer.
Each student progresses differently. There are two factors that help us determine whether a student should start prep or should take the ACT/SAT at the current time:
1. Classes a student has taken
2. Retainment from the classes
3. Math classes a student has taken
When is the earliest to start prep?
Many students can start prep as early as the summer of their 10th grade.
Again, this just depends on a student's current skillset (how much he/she has retained from his/her courses). If a student is ready to start prep, there's no reason to wait; if a student is not ready, there's no reason to rush the process.
When is the latest to take the test the first time?
The latest a student should take the test the first time is June/July of his/her 11th grade (end of 11th grade academic year).
Taking the test for the first time in September/October of a student's 12th grade is not advisable. The reason is that if a student does not perform well in September or October, he/she will not have another opportunity to take the test again before submitting his/her application.