The Wikipedia article regarding the UK House of Commons is a useful starting point to look for this information. The most relevant piece of legislation regarding standing for election is the Electoral Administration Act 2006 (2006 c.22), s.18:
- Certain Commonwealth citizens
(1) In section 3 of the Act of Settlement (1700 c. 2), the words
from "That after the said limitation shall take effect" to "in trust
for him." (which impose certain disqualifications) do not apply (so
far as they relate to membership of the House of Commons) to a person
(a) a qualifying Commonwealth citizen, or
(b) a citizen of the Republic of Ireland.
So there you have it! You have to be a citizen of "a qualifying Commonwealth [country]" or Ireland. Easy! Right? Well, yes and no.
(2) For the purposes of subsection (1), a person is a qualifying
Commonwealth citizen if he is a Commonwealth citizen who either—
(a) is not a person who requires leave under the Immigration Act
1971 (c. 77) to enter or remain in the United Kingdom, or
(b) is such a person but for the time being has (or is, by virtue of
any enactment, to be treated as having) indefinite leave to remain
within the meaning of that Act.
(3) But a person is not a qualifying Commonwealth citizen by virtue of
subsection (2)(a) if he does not require leave to enter or remain in
the United Kingdom by virtue only of section 8 of the Immigration Act
1971 (exceptions to requirement for leave in special cases).
(The rest of the section deals with disqualifications and other minor issues, which are not applicable to this discussion.)
You have to have a "right to abode" (Immigration Act 1971 c.77 as amended, s.2) or indefinite leave to enter, excepting seamen, airmen, etc. (who do not require leave to enter for temporary stays.)
What's the end result? My take on it is this: Unless you are a UK citizen, an Irish citizen, were living in the UK as a Commonwealth citizen before 1981, or are living in the UK as a permanent resident, you aren't eligible to run for office. I am not an expert in this, so my interpretation may be incorrect.