The length of coverage depends on the type of policy you have. Most traditional life insurance policies last for the duration of your life, as long as you continue to make the premiums. In other words, as long as you comply with the terms of the policy, the coverage will be in place for as long as you need it.
Term life insurance is designed to provide coverage for a specific period, such as 10 or 20 years. You may be able to extend the term of the policy or convert it to a permanent policy, but the initial term of coverage is set in the contract.
Whole life policies also provide coverage for your entire life, but they also accumulate cash value over time and build up a savings account. The cash value can also be used to pay premiums late in life if you can't afford to do so.
No matter the type of policy, it's important to review your coverage regularly and update it over time. A regularly updated life insurance policy will help ensure you're covered throughout all stages of your life.