Question Regarding Connecting Arduino Mega to APM 2.6

I am currently trying to add ultrasonic detection to my flight controller. To do this, I was told I needed an Arduino because APM doesn’t have enough processing power to handle sonar and flight control.

The way I understand it is that you connect the arduino via the I2C port on APM 2.6. Is this correct? If so, how would I be able to connect the arduino AND the compass of the GPS through the I2C port? Any suggestions or recommendations?