Biosensors for mercury (II) (Hg2+) with high sensitivity are urgently required for food safety, ecosystem protection and disease prevention. In this study, a simple and fast detection method of Hg2+ based on the molecular beacon aptamer was established, according to the principle that Hg2+ could change the structure of the molecular beacon aptamer, resulting in the changed fluorescence intensity. All of the detection conditions were optimized. It was found that an optimal molecular beacon aptamer MB3 showed the optimal response signal in the optimized reaction environment, which was 0.08 μmol/L MB3, 50 mmol/L tris buffer (40 mmol/L NaCl, 10 mmol/L MgCl2, pH 8.1), and a 10 min reaction. Under the optimal detection conditions, the molecular beacon aptamer sensor showed a linear response to Hg2+ concentration within a range from 0.4 to 10 μmol/L and with a detection limit of 0.2254 μmol/L and a precision of 4.9%. The recovery rates of Hg2+ in water samples ranged from 95.00% to 99.25%. The method was convenient and rapid, which could realize the rapid detection of mercury ions in water samples.