The true answer is because the script needed him not to, but I can think of at least three in-universe reasons: 1.) Heimdall can see the entire universe, but his ability to predict the future is fairly limited. Just because he can see Thanos’ ship warp-jumping around in space doesn’t mean he can predict where it is going.