You can rebind them through the game's key-binding options. In Portal, open the Options menu, go to the Keyboard/Mouse settings, and reassign the weapon-switch keys (for example, 1 for the crowbar/gravity gun/portal gun, 2 for pistols, and 3 for automatics). If the keys were accidentally unbound, simply set them again there.