Developing incontinence is possible at any age. With urge incontinence, it can be due to bladder or urethral irritation, infection, muscle or nerve issues, or unknown reasons.
Kegel exercises are most people's first advice, which may or may not apply in the case of urgency - that's something your doctor will help you decide. In cases of stress incontinence they're often very useful, but can be less so in urgency depending on the cause.
If it's a urinary tract infection (UTI), naturally they'll treat it with antibiotics, and the symptoms will normally clear up. Some people find that symptoms remain after the infection is treated, which generally means that the infection triggered an underlying problem.
Nerve and muscle problems can be caused by things as diverse as overactive bladder (OAB), ALS (Lou Gehrig's Disease), multiple sclerosis, and spinal injuries. There can be lots of different causes, some serious, some less so; this is why it's so important to see a doctor and get a diagnosis. Be sure your doctor knows any other symptoms you're having, as some doctors can be quick to assume it's OAB and give you medications without doing a full workup, and they may miss something important. You often need to be your own advocate and ask lots of questions about the symptoms you're having.
Medications can include things to relax the bladder and things to reduce bladder irritation. Many get relief from the medications, but some don't, and some have side effects that make it difficult to take the medication.
Other things you can do include lifestyle changes and bladder training programs. For instance, your doctor may recommend that you cut out caffeine, spicy foods, and various other things that can be bladder irritants. He or she may suggest that you work on a timed voiding schedule, where you go to the restroom on a schedule - perhaps once an hour to start, and gradually increase the time between trips.