Opposition is the time when an outer planet or the Moon is located 180° away from the Sun (in other words, in the opposite part of the sky) as seen from Earth. It is then generally at its closest to us and in the best position for observing. The Moon is in opposition when it is full. Because planetary orbits are elliptical, some oppositions are closer than others; the effect of this is particularly important in the case of Mars.
Clearly, only planets that are further from the Sun than Earth is, i.e., outer planets, can be in opposition. However, both outer planets and inner planets (Mercury and Venus) can be in conjunction.