"Apocalypse" is (depending on who you ask) the ninth movie in the X-Men universe. Some questions remain however, how all nine of these movies fit in with each other. The timeline of the movies, like the comic books, is very confusing and filled with contradictions and retcons ("a piece of new information that imposes a different interpretation on previously described events, typically used to facilitate a dramatic plot shift or account for an inconsistency.")
So, what does the timeline of this universe actually look like? Let's see if we can find out, by taking a closer look at each movie. (For now, we're going to look at them in the order they were released.)
The first movie in the original series, "X-Men" introduces us to Wolverine, Storm, Rogue, Cyclops, Jean Grey, Professor X, Magneto. The film focuses on Rogue discovering her powers, and worrying about what she can do, leading to Magneto kidnapping her for his own gain.
X2 finds the X-Men teaming up Magneto's team to take on William Stryker who is working to eliminate all mutants on the planet. By the end of the movie Jean Grey is dead, sacrificing herself to save the other X-Men.
"X-Men: The Last Stand" (2006)
Worthington Labs discovers a "cure" for the Mutant Gene and starts offering it to any mutant who wants it. While some mutants, such as Rogue, are thankful for the cure, others, with Magneto as their leader, are disgusted by the idea, fearing it will lead to the extinction of mutants.
It is also discovered that when Jean Grey sacrificed herself at the end of "X2" she also released the Phoenix, a powerful and destructive version of her personality. Jean Grey, as the Phoenix, kills her former fiancé, Cyclops, and eventually returns to her childhood home. Professor X and Magneto both try to bring her back to their side, and the Phoenix eventually emerges once again and destroys the home, killing Professor X.
It eventually becomes clear that the only person who can stop Jean Grey/The Phoenix is Wolverine, since he has regenerative powers (Oh yeah, he's also in love with Jean). He kills her, destroying the Phoenix.
"X-Men Origins: Wolverine" (2009)
To be honest, I'm going to ignore this one? It stretches such a long period of time and ends up taking place before and in between some of the films, but also seems totally messed up? (Deadpool appears in this movie, but as a completely different type of character as he was in his own movie...) Let's ignore it.
"X-Men: First Class" (2011)
The first of the new series of X-Men films, "First Class" takes place in 1962, and is all about Charles Xavier and Erik Lehnsherr (who will later go on to become Professor X and Magneto, respectively) meeting for the first time and them finding other mutants.
The pair realize that another group of mutants are behind the Cuban Missile Crisis, and plan to star another world war, ending with Mutants ruling the world. The X-Men work to stop them, but Lehnsherr admits he shares the exclusivist view of mutants. By the end of the movie, Lehnsherr has become Magneto and turns his back on Xavier and the rest of the X-Men.
"The Wolverine" (2013)
Taking place a year after the events of "The Last Stand," Wolverine is still tormented over the death of Jean Grey. He goes on a mission to "repay his life debt" which of course turns out poorly. At the end of the movie, Wolverine's adamantium claws are removed and his bone claws return. During the post credits scene, Magneto returns to tell Wolverine that a horrible new threat is approaching, and reveals Professor X, who we all thought was dead.
"X-Men: Days of Future Past" (2014)
HERE'S WHERE THINGS GET CONFUSING AF!
In the future, robots called Sentinels are killing mutants, their allies and people who could produce a mutant in the future. The Sentinels are the creation of Dr. Bolivar Trask, who Mystique had assassinated in the past and caused the panic over mutants. A group of mutants, including the older version of Magneto, Professor X (who we thought was dead...), Wolverine (suddenly with his adamantium claws again) and Storm devise a plan to send Wolverine's consciousness back tho is 1973 body to stop the assassination.
While the assassination doesn't happen, the world still becomes terrified of mutants, and the Sentinel project goes forward. When Wolverine returns to the future however, it is a brand new version of the future, that seems to eliminate everything that happened in the first three movies. He wakes up in the mansion, and sees all the people he knew before, including Jean Grey, who in this reality is alive. Back in the past, Mystique is in disguise as William Stryker (remember him from X2?!) and takes that version of Wolverine into custody.
"X-Men: Apocalypse" (2016)
Set 10 years after "Days of Future Past," the newest film in the franchise will introduce us to the younger versions of characters we have only seen in the original films including Storm, Nightcrawler, Cyclops and Jean Grey. Mystique will also be in the movie, and it remains to be seen what she did with Wolverine after the events of the last film.
So what the hell happened? Here's a timeline that hopefully helps.
The original trilogy was in the world that would eventually lead to the Sentinels wiping out all mutants, so after Wolverine prevented Mystique from assassinating Trask, that whole timeline ceased to exist. Wolverine returned to 2014, where all the people he knew previously were still alive, and everyone is happy. At this point however, the question remains if that future is set in stone.
"X-Men: Apocalypse" takes place in the 80s and then there is another film slated to be released that takes place in the 90s, giving quite a bit of time before we get back to present time, and plenty of time for something to go horribly wrong.