Abu Hurairah (May Allah be pleased with him) said: The Prophet (PBUH) said, "He who takes an oath and involuntarily says: `By Al-Lat and Al-`Uzza should at once affirm: `La ilaha illallah (there is no true god except Allah), and he who says to his companion: `Come lets gamble should make expiation by giving something in charity."[Al-Bukhari and Muslim].
Al-Lat and Al-`Uzza were the idols of the polytheists of Arabia. To take oath or swear by them or by anything else besides Allah is an act of disbelief which takes one out of the fold of religion.
If any person swears by anything or anybody else other than Allah, he should recite "La ilaha illa Allah" and refresh and re-establish his belief in Allah. Similarly, if someone indulges in other sins, then he should repent and give in charity according to his resources. The reason is, as Allah (SWT) says: "Verily, the good deeds remove the evil deeds (i.e., small sins)." (11:114).