A couple of thoughts on this:
First, 20 seemed quite young to me for a second marriage, though not impossible, and on looking at the register image, I see Margaret is recorded as a spinster, and her father has the same surname. Also, the register gives her a being of full age (21 or over), so are you sure you have the right birth?
As for William, what does the 1851 census say about his place of birth? And 1841 if you can trace that? Ages will also be important. I see he's a blacksmith, which is a fairly settled occupation, but his father was a sailor. One possible scenario is that McKenzie senior came from Scotland and worked up and down the east coast, eventually settling in Yorkshire, but you'd have to see if you can find him in any Yorkshire records. An alternative is that William was born in Scotland and decided to move to Yorkshire - but the census should help to answer that.
There are lots of possibilities in all of this, so it's important to work steadily backwards, and find out as much as you possibly can in Yorkshire/England before launching into Scottish records.
For what it's worth, I have found a MacKenzie in another part of Yorkshire, some years earlier than this. He was born in Falkirk, spent 20+ years in the Royal Horse Artillery, then became a servant to a clergyman in Yorkshire, where he met and married my relative.
Arthur