Firstly let us discuss what are optically active compounds? These are the compounds that rotate the plane of polarized light.
Now Diastereomers are basically mirror images of two optically active compounds.
They rotate the plane of polarized light, either to the left side or to the right.
If they are present together, they cancel the effect of each other. As one will rotate the plane of light in one direction other will rotate in different direction. Resultant change in direction will be nil.
And if only one out of two is present then it will show optical activity.