During rehearsal last night there was a brief discussion of the exclamation "marry". This now archaic exclamation occurs some six times in the text of Hamlet, and often in Shakespeare's work in general.
Quoth the Oxford English Dictionary:
"marry, int. Etymology: Variant of Mary n.1 (see especially sense 1b s.v.).
1. Expressing surprise, astonishment, outrage, etc., or used to give emphasis to one's words. (Often in response to a question, expressing surprise or indignation that it should be asked)."
This meaning is derivative of the noun "Marry", specifically as in the mother of Jesus. The definition OED lists the above deriving from is:
"b. In asseverations and oaths invoking the name of Mary. Cf. marry int."
Now according to Alexander Schmidt's Shakespeare Lexicon and Quotation Dictioary, "marry" in this sense has four specific meanings in Shakespeare:
Marry, an exclamation supposed to have been derived from the name of the Holy Virgin, used
1) to express indignant surprise
2) to affirm a wish or imprecation, in which case it is joined to amen
3) to affirm any thing, == indeed, to be sure
4) oftenest as an expletive particle, == why; imparting to the speech a slight tinge of contempt