Marcus was given the contract to kill John Wick. Then the next thing we know that he was helping John Wick. Question is why? Did I miss anything?
You did not miss anything. As already mentioned in the comments, Marcus helped John because they were good old friends. One way of knowing that is that Marcus is shown attending John's wife's funeral at the beginning. As to the "Marcus helping John part", it's because, at the last moment, Marcus chose friendship over money.
They must have been communicating, otherwise Marcus wouldn't know when and where John will be.
No. They were not communicating. Marcus knows that John is at Hotel Continental because that's where all the gangsters reside when they're attending business and John is staying in the same room he used in the old times before he retired.
John wasn't worried about the first shooter, he was fighting Perkins as if there is no other killer. So John knew Marcus is helping him.
No. If you re-watch the scene again, you'll notice that John knows that someone is shooting but his main priority is to deal with Perkins who is an immediate threat to his life.
Even when they meet after the saving of John Wick for the second time they don't discuss really why Marcus helped him?
It doesn't matter. As the main villain mentioned in the beginning, John Wick is sheer will and focus. I'm guessing that John is intelligent enough to understand that Marcus took the contract for money but for the old times and Friendship's sake, he changed his mind.