25 Pa.C.S. § 1302
(a) General rule.—
(1) For the purpose of registration and voting, no individual shall be deemed to have gained a residence by reason of presence or lost a residence by reason of absence in any of the following circumstances:
(4) An individual who resides at an institution for the mentally ill or the mentally retarded, if otherwise qualified under section 1301, shall be deemed at the individual's option a resident in one of the following:
(b) Rules for determination.— The following apply:
(7) An individual employed in the service of the Federal Government or of the Commonwealth and required thereby to be absent from the municipality where the individual resided when entering that employment and the spouse of the individual may remain registered in the district where the individual resided immediately prior to entering that employment, and the individual and the spouse shall be enrolled in the political party designated by the individual or spouse without declaring a residence by street and number.