Does it matter whether I take the SAT or ACT in my junior year or my senior year of high school?

Most students plan to take these exams in the spring of their junior year, and there are reasons why this is a good strategy. Fall of senior year is typically the time when you'll be sending in applications and filling out financial aid forms, so it's important to try to have your scores in by then. It's also not a bad idea to take the exams earlier rather than later so that you'll have time to retake them if you want to try for a better score.
If you're worried that you'll be at a disadvantage by taking the tests early — perhaps because you're afraid of questions that are too advanced for you to answer — fear not. Reviewing for the math and grammar sections is a great idea, but you'll be relieved to discover that the concepts covered on the exams are generally not ultra advanced. One of the best things you can do to be prepared is to spend some time learning about and practicing test-taking strategies. Take the time to attend any test-prep classes offered by your school and/or check out a guide book with plenty of samples and practice tests.