We develop a scheme for finite-size corrections of vertical transition energies and single-particle energy levels involving defect states with built-in ionic polarization in supercell calculations.The method accounts on an equal footing for the screening of the electrons and of the ionic polarization charge arising from the lattice distortions. We demonstrate the accuracy of our corrections for various defects in MgO and in water by comparing with the dilute limit achieved through the scaling of the system size. The general validity of our formulation is also confirmed through a sum rule that connects vertical transition energies with formation energies of structurally relaxed defects.