Let me just preface this by saying that your question has successfully (and inadvertently) combined two of my favourite things in life: Scottish history and Star Trek. That said, I am not a modern historian so I welcome corrections and/or elaborations from any of the other AH experts out there who might have a firmer grasp of twentieth-century Scottish history than I. In the meantime, though, here's a broad overview and some recommended reading for you if you'd like to delve further.
Scotland in the 1960s was a grim place, the result of high unemployment due to widespread shipyard closures and the failure of traditional industry. The economic depression this caused was severe enough that it contributed vastly to a surge of Scottish nationalism and a call by Scottish politicians for independence from the United Kingdom.
It wasn't so much that Scots were the targets of widespread fear or prejudice - I think that post-war and post-colonial Britain reserved these attitudes primarily for Caribbean and Indian immigrants, and perhaps for the Irish as well - but Scotland itself was, at the outset of the decade, politically and economically sterilized. But the '60s saw the first steps toward Scottish devolution and the rise of the SNP which is now the strongest party in the country. I won't get into the political history of this movement though since it's not what you asked for. Instead, I'll wrap up with some Star Trek history instead that might explain Scotty's origins a little better.
When James Doohan first went to read for Gene Roddenberry for a character whose only designation was 'engineer' (in the initial stages of the show, Scotty was not intended to be a recurring character with as large a role as he eventually ended up playing), he did so in a number of different accents. Roddenberry asked the actor which accent he'd prefer for the character to which Doohan replied, 'If you want an engineer, in my experience the best engineers are Scotsmen,' and that's how Scotty ended up being Scottish. Indeed, the character was named for Doohan's grandfather, Montgomery, and Doohan gave him his own birthday as well - describing Scotty as '99% James Doohan and 1% accent'.
It would have been delightful if Scotty was intended to make the same kind of political statements as Uhura and Chekov, but sadly, his origin is mostly just 'the Scots have a reputation for being good engineers so let's make this character Scottish.'
Still, I promised you some recommended reading on Scotland in the '60s so here are a couple if you're curious or bored:
David McCrone. Understanding Scotland: The Sociology of a Nation (Routledge, 2002).
Jim Phillips. The industrial politics of devolution: Scotland in the 1960s and 1970s (Manchester University Press, 2008).
I'll just go a bit further here to address the secondary implied question here, which would seem to me to be "if the 60s were a time of any substantial bigotry or oppression against the Scottish, was this relevant to or a reason for the creation of the character of Montgomery Scott" from the standpoint of the Star Trek series.
And the answer there is fairly certainly "no". Beyond the simple fact of his being Chief Engineer, the character of Montgomery Scott was, broadly speaking, conceived by James Doohan, who played him. Doohan, who was Irish Canadian, had a love for languages and accents, which had been in particular fostered during his WWII service abroad (in which he lost a finger on D-Day, which is assiduously hidden from the camera, incidentally). For this reason (and for lack of professional consultants on such subjects), he was also responsible for the conception (but not the full elaboration) of the Klingon language.
Scottish was just one of a number of accents he performed for Roddenberry, in their work on the character, but ultimately it was the one Doohan himself selected, based on the observation that the Scots had been great engineers.
Irish was the accent with which he had the greater personal connection, both his parents being Irish (and only immigrating to Canada in adulthood), and this accent too, he performed for Roddenberry, before selecting Scottish. So one can hypothesise an alternative scenario where he ends up, like Walter Koenig does while playing Chekov, parodying his parents (who in Koenig's case were Lithuanian Jews). But his love of accents and languages extended beyond any single personal experience. And no doubt he had run into a few Scots during his wartime service in Britain. There is one family inspiration in the character of Montgomery Scott for Doohan, at least, however. "Montgomery" was his mother's maiden name, and he chose it in remembrance of his grandfather.