Anyone can practise yoga
Yoga is non-competitive and suitable for anyone, regardless of their age or fitness level.
Your yoga teacher should carefully guide and observe you and modify postures when necessary.
An asana should never cause pain. If it hurts, ease back on the stretch or don't do it at all. It is important to keep within your physical limits.
If you are over 40, haven't exercised for a long time or have a pre-existing medical condition, you should check with your doctor before starting any regular exercise routine.