There's no official rule for this, but it's a common enough house rule. In D&D 3e (and AD&D) I allow them to make whatever check is situationally sensible to try to catch them, and then require a Strength check for them to not be pulled over as well. Some DMs seem to feel like it is being "too soft" on the players to give them a second chance, but in my experience, giving them a chance to catch their comrade with a house rule is not unbalancing at all. Because it's not unbalancing to give them a chance, the actual DCs and checks you use don't really matter for balance purposes either.
The implications of this house rule are actually rather interesting. It feels like giving the PCs a break, but it actually just ups the ante on the trap. Instead of having one character fall in on a bad roll, that bad roll triggers a double-or-nothing gamble: neither PC falls in, or both fall in. It's actually rougher on the PCs because the stakes are higher, and it makes it more likely that there won't be anyone at the top who can help them out of the pit.
Hilarity ensues when a third PC tries to stop the second one from being pulled in, and so on. I've had an entire party rope themselves together, forget to tie the rope to anything other than a PC, and all of them fall down a chute to a nastier level of the dungeon due to bad rolls.
It gets factored in as part of the calculations only for the offhand if you don't have the Two Weapon Fighting feat, but honestly you should just ignore that wording as it's confusing. Two-Weapon Fighting spells it out much more clearly:
If you wield a second weapon in your off hand, you can get one extra
attack per round with that weapon. You suffer a -6 penalty with your
regular attack or attacks with your primary hand and a -10 penalty to
the attack with your off hand when you fight this way. You can reduce
these penalties in two ways:
If your off-hand weapon is light, the penalties are reduced by 2 each. (An unarmed strike is always considered light.)
The Two-Weapon Fighting feat lessens the primary hand penalty by 2, and the off-hand penalty by 6.
If you look carefully, the extra -4 is showing up in the first part, where your main hand gets -6 and your off-hand gets -10. It's still there with a light weapon (-4, -8). It disappears if you take the two weapon fighting feat, which reduces the main hand penalty by 2 and the off-hand by 6 (the difference is the -4 you noted being removed).
So while everything is being applied correctly, the wording of the part you noted is bad. Just use the Two-Weapon fighting entry itself, as it's wording is clear and the table summarizes very well what's going on.
The total penalties go like this, if you're curious:
Main-Hand: -2 for using two weapons, -2 for non light weapon, -2 for not having Two Weapon Fighting Feat = -6
Off-Hand: -2 for using two weapons, -2 for non light weapon, -2 for not having Two Weapon Fighting Feat, -4 for off-hand penalty (the rule you were curious about) = -10
edit - Using the example from the RotG article, you could argue (as the author does) that the off-hand penalty applies if you're wielding two weapons but only attacking with one of them (whichever weapon you picked as your off one). The off-hand would take the -4 for being offhand, but not the two weapon fighting penalties (as you're only attacking with one weapon). That's the cited example.
It never applies if you're only using one weapon, no matter what hand it's in, because "off-hand" is something that only appears under the two weapon fighting rules. The rules don't care which hand you use if you're only wielding one weapon.
By my reading, it also doesn't apply even if you're wielding two weapons but only using one of them to attack. RAW treats that as your main hand, no matter what. But if you wanted to use the Rules of the Game article's interpretation, then you'd have to pick an off hand as soon as you pick up a second weapon. Either way, when only wielding a single weapon it doesn't matter which hand you use.
Best Answer
Climbing onto a creature makes that creature a mount
A creature needn't be friendly nor mount-like for a creature to attempt to use it as a mount. Because mounted combat is given the short shrift by the Player's Handbook, I've very reluctantly relied on parts 1, 2, 3, 4, and 5 of Skip Williams' Rules of the Game columns "All about Mounts" for parts of this answer. While these columns are often derided for their inaccuracies, without them, this process of playing a rider astride a hostile mount is impossible and, more broadly, mounted combat is nearly opaque and nearly unplayable and requires a raft of house rules to make it playable. So rather than dismissing or ignoring these columns, as long as they're expanding and not contradicting the core rules, I think they're safe to use for this purpose. If nothing else, they provide some insight into the game's expectations according to one of the game's lead designers and the author of its Monster Manual. Anyway, the turn of a creature that wants to use a hostile creature as a mount looks like this:
The potential rider makes a Ride skill check to fast mount (DC 20) and suffers a −5 penalty on this check if the creature is "ill-suited as a mount," suffers a −5 penalty on this check if attempting to fast mount a creature lacking a saddle, and suffers his armor's armor check penalty on the check (see PH 80 for all these modifiers). Success means that the rider takes a free action to become the mount's rider. Failure means that the rider takes a move action to become the mount's rider.
Things to remember
Riding a totally hostile mount that's trying to eat the rider isn't detailed in the core rules nor in the columns, but under Unofficial Optional Rules (in a column with a lot of unofficial optional rules but this one is actually called that) on Riding along with an Aggressive Mount in "All about Mounts, Part 4" there's the following:
Thus the typical rider will usually be stuck with taking only a standard action (or a move action instead) while astride that hostile mount if the rider can take any actions at all. The hostile mount, on the other hoof, can just stay where it's at (or take a 5-ft. step) and full attack the crap out of the rider, usually making this a really bad deal for the rider.
As an aside, the alternative to giving the mount its head (the link's to the term's definition; it's okay—it's work-safe) is for the rider to convince the mount via wild empathy or pleasant conversation to obey the rider. Good luck with that, Mr. I'ma-gonna-ride-this-here-behir.
A hostile mount can force an uninvited rider off of it by successfully tripping the rider (see Tripping a Mounted Defender (Rules Compendium 145)). Alternatively, the mount seems to be able to able to easily attempt a bull rush against its rider—the two creatures already share the mount's space, so it's possible the mount won't even provoke an attack of opportunity, but a failed bull rush attempt renders the mount prone as the space it's "returning to" is occupied by the rider. (Then things get complicated for the mount—see Sharing Spaces (RC 95).) A Huge or bigger mount may have to beat a Medium rider's check by more than 5 to shove a rider out of the mount's own space.
Final thoughts
The tactical feat Giantbane (Complete Warrior 111) and its tactical maneuver climb aboard mechanizes this tactic in an entirely different way and was published 2 years before these columns. Also, the style feat Hammer and Piton (Dungeonscape 45-6) mechanizes this tactic in a third and different way and was published 2 years after these columns appeared. The method described above, however, has the advantage of being available to any creature without a creature needing to light a feat on fire to do something many kind of think any adventurer—if he really wants to—should be able to do anyway.
And even though it certainly should have, the Dragon #336 Silicon Sorcery column covering the video game Shadow of the Colossus (88-90) sadly doesn't include rules for running around atop the creature, although it includes rules for gaining purchase on one: the primordial colossus's extraordinary ability impassive says, "Creatures daring to approach a primordial colossus can make a DC 20 Climb check. If succssful, the creature is capable of a grabbing hold of the colossus and riding upon it." If the colossus is moving when this is attempted and the attempt fails, the creature that failed is dealt 4d8+19 points of damage. That's the extent of information about doing that, though.