We investigate the expected correlation between the weak gravitational shear of distant galaxies and the orientation of foreground galaxies, through the use of numerical simulations. This shear-ellipticity correlation can mimic a cosmological weak lensing signal, and is potentially the limiting physical systematic effect for cosmology with future high-precision weak lensing surveys. We find that, if uncorrected, the shear-ellipticity correlation could contribute up to 10 per cent of the weak lensing signal on scales up to 20 arcmin, for lensing surveys with a median depth z(m) = 1. The most massive foreground galaxies are expected to cause the largest correlations, a result also seen in the Sloan Digital Sky Survey. We find that the redshift dependence of the effect is proportional to the lensing efficiency of the foreground, and this offers prospects for removal to high precision, although with some model dependence. The contamination is characterized by a weakly negative B mode, which can be used as a diagnostic of systematic errors. We also provide more accurate predictions for a second potential source of error, the intrinsic alignment of nearby galaxies. This source of contamination is less important, however, as it can be easily removed with distance information.