The so-called "Status of Forces Agreement" (SOFA), which will be signed by Defense Minister Raimonds Bergmanis and United States ambassador to Latvia Nancy Bikoff Pettit, sets the borders of legal jurisdiction operating upon US personnel while they are stationed in Latvia and supplements existing NATO agreements.
The agreement was approved by the Latvian government in a closed cabinet session January 10. It does not give US personnel total immunity from the possibility of prosecution in Latvia as, in theory, if a waiver is obtained the Latvian prosecutor general could still bring charges should any such personnel be accused of particularly serious crimes.
However, it does provide US personnel with a wide range of other immunities "in accordance with modern requirements" according to a Defense Ministry statement.
The US is expected to sign similar deals with Estonia and Lithuania in coming days too.
According to a report produced for the US Department of State, there are several different reasons for SOFA agreements:
"It is a generally accepted rule of international law that any person present in a country is subject to that country’s laws unless that country has consented to some limitation of its jurisdiction. SOFAs establish agreed exceptions to this rule because, by them, the host government agrees to waive in favor of the sending state certain jurisdictional and other rights it would otherwise have."
Another reason for SOFAs is to: "Protect against U.S. personnel being subject to host country criminal or civil justice systems. This is important not only to protect U.S. personnel’s rights and to vindicate the U.S. interest in exercising disciplinary authority over its personnel, but also because U.S. willingness to deploy forces overseas – and public support for such deployments – could suffer significant setbacks if U.S. personnel were at risk of being tried in a potentially unfair system. The United States also has an interest in preserving the principle that U.S. military discipline is enforced by the U.S. military justice system."
You can read more about Status of Forces agreements between the US and its allies HERE.