Germany will send troops to help dig trenches and build anti-tank barriers along Poland's borders with Belarus and Russia.