Nonlinear dynamics of semiconductor lasers is applied for microwave frequency division. Optical injection is used to drive a slave laser into the dynamical period-two state. A fundamental microwave frequency and its subharmonic are generated in the power spectrum. Both frequencies will be simultaneously locked when an external microwave near either frequency is applied on the bias. In our experiment, precise microwave frequency division is demonstrated by modulating the laser at the fundamental of 18.56 GHz. A locked subharmonic at 9.28 GHz with a low phase variance of 0.007$hbox rad^2$is obtained from a 10-dBm input. A large locking range of 0.61 GHz is measured under a 4-dBm modulation. Similarly, precise frequency multiplication is demonstrated by modulating at 9.65 GHz. At an input power of$-$5 dBm, a multiplied signal at 19.30 GHz is obtained with a phase variance of 0.027$hbox rad^2$and a locking range of 0.22 GHz.