I am pretty sure that your David was the son of David Sim and Elizabeth (Olmstead) Marshall with David being the son of John and Janet (Sim) Marshall, probably Loyalists, who settled in the Cumberland Bay area of Grand Lake, Queens Co., NB ca. 1783-5. As to how he got to New Zealand, it is pretty clear that David, Sr.'s family were sea farers, at least two of his sons in command of their own ships. There was also the 1850 gold rush to Australia where young men in New Brunswick would finance the building of a ship (i.e., the aptly named, "Australia"), sail it to Australia and sell it, splitting up the proceeds and parting to make their way to the gold fields. The latter is possible as I do not find your David in 1851 but I do find his father.
I find at least 5 David Marshall's of which 3 are David Sim Marshall (or a variation) making things a bit tricky. Also tricky is that a very cursory search produced 6 pages of information and there is more to be found. I do not know if I can post something that size here (although I have done and received complaints).
I have found nothing specifically on your David (having left before the first, available census), but John Robertson Marshall, Chief of Police of the City of Saint John, Saint John Co., NB, did have a brother who was in New Zealand by 1888. John Robertson Marshall is pretty certainly the s/o David Sim and Elizabeth (Olmstead) Marshall.