Ahh, but in another episode they mentioned that even though they had Baltar's program, it'd never been loaded into the computer banks. (One of the first ones, I think - possibly the miniseries).
My own explanation is that the computers on Galactica had two modes; standalone and networked. In standalone mode, the computers reject any kind of outside connection. In networked mode, however, they first query the connection.
Since networked computers are rarely used on Galactica, it's possible that they weren't as hack-proof as they could've been. So maybe someone had an unsecured wireless line here or there in the ship, that wouldn't usually matter because the computers would reject all connections, but in this case it would. Plus, Galactica had its Dradis and Comm systems running, possibly exchanging data with the Vipers, creating another point of vulnerability. (Buffer overflow errors and the like)
Galactica was sort of like a Windows XP computer without any service packs and only a simple firewall, whose prime form of defense against cracking was that people used the phone instead of going online to IM.