We report direct numerical simulations of a pair of wings in horizontal tandem configuration, to analyze the effect of their aspect ratio on the flow and the aerodynamic performance of the system. The wings are immersed in a uniform free-stream at Reynolds number Re = 1000, and they undergo heaving and pitching oscillation with Strouhal number St = 0.7. The aspect ratios of forewing and hindwing vary between 2 and 4. The aerodynamic performance of the system is dictated by the interaction between the trailing edge vortex (TEV) shed by the forewing and the induced leading edge vortex formed on the hindwing. The aerodynamic performance of the forewing is similar to that of an isolated wing irrespective of the aspect ratio of the hindwing, with a small modulating effect produced by the forewing-hindwing interactions. On the other hand, the aerodynamic performance of the hindwing is clearly affected by the interaction with the forewing's TEV. Tandem configurations with a larger aspect ratio on the forewing than on the hindwing result in a quasi-two-dimensional flow structure on the latter. This yields an 8% increase in the time-averaged thrust coefficient of the hindwing, with no change in its propulsive efficiency.