Mothers can determine which genotypes of offspring they will produce through selective abortion or selective implantation. This process can, at some loci, favour matching between maternal and offspring genotype whereas at other loci mismatching may be favoured (e.g. MHC, HLA). Genomic imprinting generally renders gene expression monoallelic and could thus be adaptive at loci where matching or mismatching is beneficial. This hypothesis, however, remains unexplored despite evidence that loci known to play a role in genetic compatibility may be imprinted. We develop a simple model demonstrating that, when matching is beneficial, imprinting with maternal expression is adaptive because the incompatible paternal allele is not detected, protecting offspring from selective abortion. Conversely, when mismatching is beneficial, imprinting with paternal expression is adaptive because the maternal genotype is more able to identify the presence of a foreign allele in offspring. Thus, imprinting may act as a genomic 'cloaking device' during critical periods in development when selective abortion is possible.