The second commandment forbids false oaths. Taking an oath or swearing is to take God as witness to what one affirms. It is to invoke the divine truthfulness as a pledge of one's own truthfulness. An oath engages the Lord's name. "You shall fear the LORD your God; you shall serve him, and swear by his name."
Source: Catechism of the Catholic Church (Vatican.va)