The double beta decay of 100Mo to the 0^+_1 and 2^+_1 excited states of 100Ru is studied using the NEMO 3 data. After the analysis of 8024 h of data the half-life for the two-neutrino double beta decay of 100Mo to the excited 0^+_1 state is measured to be T^(2nu)_1/2 = [5.7^{+1.3}_{-0.9}(stat)+/-0.8(syst)]x 10^20 y. The signal-to-background ratio is equal to 3. Information about energy and angular distributions of emitted electrons is also obtained. No evidence for neutrinoless double beta decay to the excited 0^+_1 state has been found. The corresponding half-life limit is T^(0nu)_1/2(0^+ --> 0^+_1) > 8.9 x 10^22 y (at 90% C.L.). The search for the double beta decay to the 2^+_1 excited state has allowed the determination of limits on the half-life for the two neutrino mode T^(2nu)_1/2(0^+ --> 2^+_1) > 1.1 x 10^21 y (at 90% C.L.) and for the neutrinoless mode T^(0nu)_1/2(0^+ --> 2^+_1) > 1.6 x 10^23 y (at 90% C.L.).