I did BMQ quite awhile ago, but I'm sure this info is still relevant
Before heading to BMQ I recommend you be able to at least run 5kms in under 30 mins and be able to at least double the minimum amount of push ups, and sit ups that you are required to do. The more you can do the better. Also, be able to lift/squat your own weight, do chin ups, etc; you don't need to be able to do 20 chin ups for BMQ, but being able to do a couple is a good start.
In your workouts, do various sets of all types of push ups, as well as weight lifting. When doing weights, work out your whole body, don't just do the bench press. Work out arms, chest, back, legs, etc. High Intensity Training and swimming is also good to do. For runs, mix it up with distance runs and sprints. Don't forget to work out your back and core.
Lots of info on various exercise programs and military specific workouts available on the internet. If you aren't in the best of shape, start off slow, don't jump right into a program that is above your current fitness level.
Do not run or work out everyday, have some breaks during the week. Do not over train yourself to the point where you are doing more harm then good and possibly getting yourself injured.
Eat well, and get your 8 hours of sleep. Poor diet and sleep will have negative effects on your fitness gains and health. Take care of your body, and hopefully you won't have any issues on course like getting yourself injured, failing a PT test, etc.
Oh and lastly, after BMQ in between courses you will spend time on PAT Platoon. DO NOT slack off during this time, the group PT you do on PAT/PRETC will vary depending on where you go. So, if you are in a place that doesn't too much organized PT, do it on your own. Even if you are in a PAT Pl with daily PT, have the occasional work out at night/weekend. Your PT could consist mostly of running, some HIT and a ruck march. Do some weight training at the base gym, to help with your strength, etc in your off time.