How long should I wear my foot cast for?

Depends. This is dependent on the injury and the instructions of your doctor. If you have questions ask you treated physician.
Dr said what? For as long as your doc tells you to. Likely, your doc will base this decisio on the fact bone heals in 6-8 weeks and they likely will be taking x-rays during this time to determine if you need to be in there for longer or a shorter period.
Usually 4-8 weeks. Healing rates may vary on various factors. In general bone may take 4-8 weeks to heal. You may be placed in a cast initially and then be asked to wear a rigid walking boot for the remainder of the healing process.