We need to import quite many topics and replies from a legacy system to community, and we want to use bulk insert from sql server to do this.
Is it safe to do this by just adding rows to the topic and reply tables or is there something else we also need to be aware of in terms of triggers in sql or in code which might insert stuff other places as well?
I'd suggest you have a look at the migration script from Community 3.2 to 4.0. It does basically the same thing, albeit with a different schema in the source database. A couple of adjustments of the SELECT statements and removal of large chunks of the migration of the other tables and you should be well on your way. There are a couple of triggers that update some counters here and there, but those details have been handled in the script.
The database migration script is available here: http://world.episerver.com/Download/Items/EPiServer-Community/EPiServer-Community-40/Database-Migration-Script-for-EPiServer-Community-32-to-40-and-EPiServer-Mail-44-to-50/