Fencing was added to the Olympics right in the Games' first edition of the modern era, in 1896, when the event was hosted in Greece. Ever since, fencing has been part of the Olympic program, and it is one of only four other sports to be featured in every single edition of the Olympic Games.
While today there are a total of 12 fencing events in the Olympic games, it wasn't always the case, and fencing in the 1896 Games was much different from what it is today. To begin with, in 1896 there were only 3 fencing events, and all for men: saber, foil, and foil for professionals, who were considered fencing masters. All bouts were played up until 3 touches, and there were not nearly as many competitors as there are today. Even the sport itself was very different from what it is today. Nonetheless, it was still fencing, and it pleased the members of the IOC enough to be present in the next Olympics in 1900, and well, in every single one after that.
In the first edition of the Olympic games, women were not allowed to participate in any sport, and thus there were no women's fencing events. Slowly but surely, women made their way into the Olympics, with the first female athletes taking part right in the 1900 edition of the Games, however it took a little longer than that for female fencers to appear in the Olympics. In the 1924 Games, a women's foil event was added to the program. In 1960 a women's foil team event was added to that, totalling 2 women's disciplines and 6 men's. It took a while, but women's fencing finally caught up with men's events; in 2004 women's saber team was added as an event, and there were 5 women's events and 5 men's events.