Release dates changed and they weren't allowed to address some stuff due to Avengers: Endgame coming out so they had to have the team survive. It's addressed in the interview below.
ENTERTAINMENT WEEKLY: You guys had been hinting at possibly incorporating the Infinity War ending. Why didn’t we see that in the finale?
JED WHEDON: There’s some of that we can’t answer.
JEFF BELL: Part of what happened was, they changed the release date.
BELL: And we move at a different schedule than they do and so suddenly everything was a week earlier, and so we had to make some adjustments and that’s how we end up with our story.
WHEDON: Right. And the other thing is that there’s certain story points that are so — there would really be no way for us to address it and keep our show intact. Given that there’s another movie coming out, and there’s gonna be constant repercussions of their universe, so what we felt was that the safe play for our story, and for the integrity of our universe, was to operate outside of it.
BELL: To acknowledge it was happening, but that we had our own problems and we’re dealing with that.
WHEDON: Right, and also the timeline is a little bit fudged in that we assume that the last couple of episodes of our show take place during Infinity War. We’re running in a lot of real-time at the end of the season.
MAURISSA TANCHAROEN: The last four [episodes] all in real-time.
WHEDON: Yeah, so we sort of thought of it as these events are still ongoing as our season ends.
What would that mean if the show is renewed? Is the team somehow magically exempt from Thanos’ snap?
WHEDON: Yeah, well what we like is painting ourselves into a corner, so that the problem we face is not that our show went off the air, it’s that it’s back on the air. “Oh no, now what?” Yeah, so we’ll have to figure out how that plays, and it’ll depend on what the season looks like and our air dates and all that. So, yeah, that’s a bridge we’ll have to cross.
BELL: We call it a classy problem.
Entertainment Weekly, Agents of S.H.I.E.L.D.: Did the finale include Infinity War shocker?
This also holds true for season 6 in that again the network was unsure of when they were going to air it. As such they had to do it "before snap" so apparently Season 6 is before the snap even though season 5 mentions it.
“We were told we were going to be on in May, but we planned a path and ABC said, ‘All right, we [might] need you in January,’” said executive producer Jeffrey Bell. “And so because our start date was in flux, we couldn't come in and do something before Endgame happened and then have Endgame happen in the middle of what we were doing.
“Imagine if we had incorporated it and then at the last minute the network was like, 'We'd love to have this on in January!'" Whedon said. “Then all of a sudden we've spoiled something horribly. So we made the decision to just be pre-Snap, and tell our story and just carry it forward. And hopefully by the end of these next two [seasons] it'll be satisfying and in no way a thing that bothers you about the show… We have our logic and we don't spend any time saying, ‘So…’ because we just want people to enjoy our story.”
“And I live in a world where there's enough Time Lords and Chronicoms that live in the internet that they'll figure it out and explain it back to us,” added Marvel TV boss Jeph Loeb. “It does work – you just have to figure it out.” That statement suggests a scenario reminiscent of the No-Prize tradition established by Stan Lee back in Marvel's comic book letter columns, where readers vied for bragging rights by writing in with their own logical solutions to continuity gaffes that were missed by the editorial team.
“There were just too many questions, too many threads, too many words we were not allowed to say, if that makes sense,” said Bell. “So the easiest way to not have to incorporate or dodge questions about that was for us to just make the decision this season happens pre-Snap.”
IGN, DOES AGENTS OF SHIELD SEASON 6 TAKE PLACE BEFORE AVENGERS: ENDGAME OR AFTER?