Oxygen vacancies can be of utmost importance for improving or deteriorating physical properties of oxide materials. Here, we studied from first-principles the electronic and magnetic properties of oxygen vacancies in the double perovskite Sr$_2$FeMoO$_6$ (SFMO). We show that oxygen vacancies can increase the Curie temperature in SFMO, although the total magnetic moment is reduced at the same time. We found also that the experimentally observed valence change of the Fe ions from $3+$ to $2+$ in the x-ray magnetic circular dichroism (XMCD) measurements is better explained by oxygen vacancies than by the assumed mixed valence state. The agreement of the calculated x-ray absorption spectra and XMCD results with experimental data is considerably improved by inclusion of oxygen vacancies.