Every commentary I could find has seemingly a different interpretation on this passage! I have however, managed to distil these down into two main interpretations:
1. Jesus was going to pass them by, but was diverted
The phrase "meant to" in the ESV and RSV is also translated "would have" in the KJV. The Greek word used here is thelō which means to wish or desire, and is the emotional element that leads to the consequent action (rather than a reasoned decision). I.e Jesus wished to pass by them. The Interpreter's Bible elaborates further:
This feature in the story, so strange to us, served originally to make more vivid the fact that Jesus was diverted by their evident distress from his purpose of following and overtaking the disciples in the morning on the other shore;
It would seem Jesus wanted to pass them by, but their state of distress caused him to reconsider his plans. The ESV Study Bible goes further on this interpretation, giving the following reason:
He meant to pass by them, not so that they would fail to see him (in which case he would have stayed farther away from them), but so that they would see him “pass by” (Gk. parerchomai), walking on the water, thus giving visible evidence of his deity (and thus answering the question they asked after he stilled the sea in Mark 4:41: “Who then is this … ?”). The passage echoes the incident where God “passed” before Moses (the same verb, parerchomai, occurs in the Septuagint of Ex. 33:19, 22; 34:6), giving a glimpse of his glory.
2. It seemed like Jesus was passing them by
To gather more information on this event, we turn to John's account of the event:
...they saw Jesus walking on the sea and coming near the boat, and they were frightened.
John 6:19 (ESV)
From John's account, we learn that it only looks like Jesus was intending to pass them by - he was coming near the boat, waiting for their call. Matthew Henry explains further:
He would have passed by them, that is, he set his face and steered his course, as if he would have gone further, and took no notice of them; this he did, to awaken them to call to him. Note, Providence, when it is acting designedly and directly for the succour of God’s people, yet sometimes seems as if it were giving them the go-by, and regarded not their case. They thought that he would, but we may be sure that he would not, have passed by them.
This means that Jesus wanted to help them, but they had to first call out to him to receive his help. Divine disposition does not rule out human action. We do not sit back and wait for God to save us - we cry out to him for help!
Conclusion
As to which interpretation is correct? I am swayed by the first interpretation, mostly because of the language used in the passage and the fact one of Mark's key themes is proving Jesus' divinity. Ultimately though, this is a difficult passage to interpret, and one is called to make their best judgement in their exegesis of this passage, trusting the Holy Spirit to guide their interpretation.