According to Etymology Online, the verb assay means "to try, endeavor, strive, test the quality of"; from Anglo-French assaier, from assai (noun), from Old French essai, "trial". Thus the noun assay means "trial, test of quality, test of character" (from mid-14th century), from Anglo-French assai; and its meaning "analysis" is from the late 14th century.
For assay of currency coins this literally meant analysis of the purity of the gold or silver (or whatever the precious component) that represented the true value of the coin. This might have translated later (possibly after the 14th century) into a broader usage of "analysis", e.g., in pharmacology, analysis for an important component of a target inside a mixture—such as the active ingredient of a drug inside the inert excipients in a formulation that previously was measured only grossly by its observable action on an organism (e.g., a lethal dose or inhibitory dose).