Single crystal elastic constants of bcc iron and bct FeC and FeN alloys, martensites, have been evaluated by ab initio calculations based on the density functional theory. The energy of a strained crystal has been computed using the supercell method at several values of the strain intensity, and the stiffness coefficient has been determined from the slope of the energy versus square of strain relation. Some of the third order elastic constants have also been evaluated. The absolute magnitudes of the calculated values for bcc iron are in fair agreement with experiment, including the third order constants, although the computed elastic anisotropy is much weaker than measured. The tetragonally distorted dilute FeC and FeN alloys exhibit lower stiffness than bcc iron, particularly in the tensor component C33, while the elastic anisotropy is virtually the same. Average values of elastic moduli for polycrystalline aggregates are also computed. Youngs modulus and the rigidity modulus, as well as the bulk modulus, are decreased by about 10 per cent by the addition of C or N to 3.7 atomic per cent, which agrees with the experimental data for FeC martensite.