Eventing consists of three types of competition: dressage, cross-country, and show jumping.
According to AFP, Algotsson, 37, was the first woman on track to take the title, but her horse knocked the top pole off the final fence.
Nevertheless, Viktoria Carlerbäck, an expert for Swedish Television, called Ostholt's success getting silver, "a big accomplishment for Swedish riding."
The medal is Sweden's first in eventing at the Olympic Games since 1972, when Jan Jönsson took bronze in Sarajevo. Sweden has not won a gold in this event since 1952.
Gunilla Fredriksson, Sweden's national team manager for eventing, told Swedish television she was extremely happy, but admitted "it was a shame with the last fence. We all thought she'd made it over the obstacle when the pole bounced off."
The gold Tuesday went to the reining world champion, the German Michael Jung, and the bronze went to Sandra Auffarth, also from Germany.