Ultrasonography is one of the most common intraoperative imaging modalities for image-guided procedures in clinical practice. However, the quality of the ultrasound image depends largely on the skill and dexterity of the surgeon. We propose a robotic control system for intraoperative ultrasound imaging that optimizes visual quality of the ultrasonography using variable impedance control for regulating the contact force of the ultrasound transducer. The system consists of a human-robot-environment interaction (HREI) system and a needle insertion system. Experimental results show that the HREI system can control the robot in collaboration with the human while interacting with the environment and maintain a constant force with a maximum error of 0.2N. These results support the feasibility of our proposed approach. This study has the potential to positively impact current practices in ultrasound image-guided procedures.