This seems to imply that you think it would be ok for the FM and the head of the Civil Service in Scotland to be married.
Interesting thought experiment, but I'd suspect much less likely than FM and CEO of a political party being married. That's because those most active in political parties tend to eat, sleep and breath their politics so highly likely to ed up with someone like-minded in a party political sense as their whole lives revolve around the tiny bubble of their party politics.
A career in the civil service and a party political career are completely different things although they, of course, align in government. But as senior civil servants cannot be involved in party politics less likely that their worlds will revolve around each other as their careers develop.
But on the actual question - and I'm going to shift it to PM and Head of the Civil Service/Cabinet secretary as I know more about those roles.
Well on the one hand the role of the Head of the Civil Service/Cabinet secretary is to support the government of the day, its ministers and implement government policy. So in that respect, provided the boundaries between politicisation of the civil service are maintained to some degree the roles of PM and Head of the Civil Service/Cabinet secretary are a bit like a husband and wife, playing different roles to achieve a common goal. There probably wouldn't be too many issues with information flow as both the PM and Head of the Civil Service/Cabinet secretary would have very high level intelligence clearance and access to similar information.
I think where there would be issues would be the ability of the Head of the Civil Service/Cabinet secretary to give robust and candid advice to the PM if that person was also their spouse.
A challenge would be appointment - the PM appoints the Cabinet Secretary so it would be challenging to be confident that the process was fair and transparent. And the position is not a political appointment - by this I mean that there is no requirement that a Cabinet Secretary is replaced when a new government comes in - indeed there have been a number of examples of Head of the Civil Service/Cabinet secretary serving under both tory and labour PMs.
Weirdly there might be more challenge if the Head of the Civil Service/Cabinet secretary was married to the leader of the opposition where you might worry more that confidential government/cabinet information would leak into the wrong hands.