There are two known methods for grabbing the Scarab gun in Halo 2.
Method 1: Get a Banshee to follow you, and just before the loading screen appears, hijack it. Then fly around until you spot twin towers connected by a bridge. In the middle of that bridge you'll find a cone with a plasma rifle on it — that's the Scarab gun.
Method 2: During the Scarab fight near the water, jump into the water while inside a Scarab beam, and keep pressing RB. If you pass the Scarab gun, you'll switch to it. The catch is you only have about five seconds before you fall into the water and die — unless you've modded the game. Because of that tight window, the first method is generally the easier choice.