How much time do you have to wear braces before having jaw surgery?

It depends. It depends on how long it takes to get your teeth in proper alignment so your jaw can be moved to the correct position. With surgery you need to have a good interlocking of your teeth in the new bite for proper stability. You need to discuss this with your Surgeon and Orthodontist.
Until. Until your Orthodontist, your General Dentist, and your Oral Surgeon feel that your top teeth lign-up well to your top jaw, same for your bottom teeth/jaw, and when the jaws are moved the teeth will interdigitate ideally and allow support of the new jay positions. Usually about 2/3-3/4 of the way through your estimated time in braces. Ask your Orthodontic Specialist at your next visit.