The phrase "to buy a sword" means to obtain a weapon that has a long, sharp blade and a handle. It is often used figuratively to express a readiness to defend oneself or take aggressive action. Full definition
The real issue I want to address is why Jesus told His disciples to go buy a sword in Luke 22:36. (redeeminggod.com)
Jesus, while not explicitly condoning the use of violence in self - defense, implicitly suggests the need to be prepared for it when he tells his disciples to buy a sword if they do not have one, «now if you have a purse, take it, and also a bag; and if you don't have a sword, sell your cloak and buy one. (religion.blogs.cnn.com)
Jesus told His disciples to buy swords so that He can fulfill this prophecy from Isaiah 53:12. (redeeminggod.com)