I'd love to say the answer to that question is NEVER.
I personally feel that it's always a good idea to practice yoga.
But let's explore....
If your perception, conceptual awareness & understanding of yoga is limited to the physical asana (postures), then maybe there are a few instances when yoga may not be your first option and at best, if practiced, adapted to your needs or in some cases avoided. More on this later...
But, if you consider yoga in the broader sense of the term to include the multi-faceted wellness approach that it truly is, including postures, breathing practices, meditation, discipline for both mind and body, increased awareness, a practice of all things, insights into the spiritual being, awareness of the inter-connection between you and the world around you, a system to build a more well-rounded way of life, then in my person opinion then there is really NEVER a time to avoid yoga. This understanding ironically comes from practice, so if you were to avoid it, then you miss out on the journey as well as the lessons that yoga has to offer you.
So, back to the first perception, which is the basis to address some ideas of when and when not to practice yoga or at least modify it for safe practice.
If you are injured, you may need to modify your practice, which could be helped by an experience yoga teacher. You may find that the modified practice can speed healing time, improve overall well-being and allow your mind and body to benefit. There may be time when rest is best. If you have a significant injury, maybe movement is not your best bet, or movement of only non-affected areas. Maybe considering a mindfulness practice, or meditation, or some other facets like breathing practices.
If you are menstruating, practice is a wonderful way to ease this time, but modifications may be necessary. Avoiding inversions such as legs up the wall & down dog would be a good idea. The "downward wind" or down flow release that is required to let menstruation flow properly is governed by "apana vayu". Inversions that put the normal downward flow in reverse can disrupt the body's natural elimination at this time.
If you are pregnant, modified practices are required once you "start to show" to safely move with your new bundle of joy on board. Instead of down dog, cobra or sphinx try cat & cow flow or wide legged child's pose. Instead of laying on your back - try side laying, or creating a "ramp" with a couple blocks and a rolled up mat or bolster to lay upon. When practicing twists, sit or stand tall to lengthen the spine and twist from your heart instead of your lower torso.
If you are battling your mind or unmotivated, it's best to practice. Even if you don't feel like it. This is precisely the time to practice. Often times we feel better once we have moved, through breathing mindfully and created space for stillness.
I do not remember where the quote is from, but goes something like this....'meditate at least 5 minutes each day. if you are too busy to meditate 5 minutes each day, then meditate 30 minutes each day... this should help'. Again, ironically, the more mindfulness practices we have and integrate the more clear the mind become and our ability to manage all things 'life' improves.
So, when is your next yoga practice?
In health & happiness,