If he heard you'd gotten married, he'd be very surprised.

Literal

By-chance, you [subject-が] married [quotative-と] hear-[conditional-ば], he [topic-は] very will-be-surprised [probably-だろう].

結婚した ('got married') takes the quotative と + 聞く to mean 'hear (the news) that X.' The clause subject 君が inside the quoted content is marked with が, while the outside 彼は marks the main topic. Typical embedded-clause particle split.