The saying “live by the sword, die by the sword” is an idiom that basically means “what goes around comes around.” More to the point, “if you use violent, forceful, or underhanded methods against other people, you can expect those same methods to be used against you.”
The proverb “live by the sword, die by the sword” has a biblical origin. It comes from a conversation between Jesus and His disciple Peter just before Jesus was arrested in the Garden of Gethsemane. After Jesus was betrayed by Judas, a group of soldiers moved in to arrest the Lord. In a rash attempt to protect Jesus, Peter pulled out his sword and struck the servant of the high priest, cutting off his ear—you can be sure Peter was trying to do more damage than that (John 18:10). Jesus rebuked Peter and put a quick stop to the bloodshed. Jesus replaced the wounded man’s ear, healing him instantly (Luke 22:51). Then He told Peter to put his sword away, for “all who draw the sword will die by the sword” (Matthew 26:52). Jesus also told Peter that He would not fight the arrest, for it was God’s will that He drink the cup that was given to Him (John 18:11). Jesus had come to die as a sacrifice for sin, and now was the time. Jesus’ placating of Peter also showed His concern for His disciple—in warning Peter against using violence, Jesus prevented Peter from being arrested himself.
“Live by the sword, die by the sword” has become a common expression, adapted from Jesus’ words to Peter. The proverb’s meaning is still basically the same: a person who lives violently will probably at some point be killed in a violent manner. Violence begets violence. Those who practice violence will come to violent ends.