Space-frequency (SF) group codes are designed for multiple-input multiple-output orthogonal frequency-division multiplexing (MIMO-OFDM) systems. A rather general channel model is assumed, where the channel is frequency-selective Rayleigh fading with arbitrary power-delay profile. It is shown that the SF group code has a symmetric distance structure like the space-time group code, if the group consists of diagonal matrices. A scenario where the multiple codewords are loaded onto the subcarriers of the OFDM system in parallel is considered. The optimality condition on the choice of subcarrier allocation is found, and an optimal subcarrier-allocation scheme is proposed. A transmit scheme where rotated versions of the same signal are transmitted from different transmit antennas is proposed, and it is shown that it satisfies the optimality condition. Then matrix groups are designed which guarantee that the resulting SF codes are full rank. Numerical comparisons with recently published techniques in the literature verify our improved performance.