Grazing incidence x-ray diffraction study of Fe epitaxial ultrathin films (1.5-13 nm) on GaAs (001) reveals an anisotropy of both domain shape and strain, with [110] and [1-10] as the principal directions. It is shown that the observed thickness-dependent strain anisotropy, together with a uniaxial interface term, can provide an unambiguous explanation to the usual in-plane magnetic anisotropy and its thickness dependence observed in this magnetic thin-film system.