Hi Sinem, your picture is a perfect representation of those two phrases. Both are correct, but I would tend to add the word 'just' with the meaning of 'just one of those things that happen' When speaking these phrases, the word 'had' would be emphasised (said a little louder).
- Maybe we just had to go through that.
- Maybe that's just what we had to go through.