I'm assuming you're asking about the US, since you mentioned sport/recreational licenses.
You can take as long as you like to learn to fly, although spreading it out over multiple years will actually cost more, not less. The reason is that you forget things and take a lot longer to develop the right reactions, muscle memory and feel for the aircraft. So try to fly as much as possible and do your license as quickly as possible, within whatever time and budget limits you have; I know that not everyone has the time and money to learn to fly in one month or even one year.
As for a ground school course, they're often planned to end with you taking the knowledge test required for private pilots and that test might even be included in the price. When you take the test it's valid for two years. If you don't pass your final checkride within those two years then you'll have to do the knowledge test again first. But that doesn't mean you have to do a ground school course again, you can work with an instructor and by yourself to refresh your knowledge.
But if you're not sure about how/when to start training then the best thing you can do is talk to an instructor about your situation and expectations. Any good flight school will be happy to have someone sit down with you and answer whatever questions you have. An introductory flight would be a great way to start, if you haven't already done that.