foreign key relationships and auto-incrementing in Sql Server
You can issue the command

SET IDENTITY_INSERT tablename ON


before inserting values into a table and call

SET IDENTITY_INSERT tablename OFF


afterwards.

According to the documentation for SET IDENTITY_INSERT (Transact-SQL):


  At any time, only one table in a session can have the IDENTITY_INSERT property set to ON.


and


  If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value. 


To keep the foreign key relationship simply import the main table (Foo) before the details table (Bar).