First, let's be clear that this issue has nothing to do with SharePoint at all.
This falls 100% in the SQL admin realm. I only mention this so that if you do
any followup research that you don't throw SharePoint into your search and
potentially limit your results.
SQL writes every transaction to the the transaction log (the LDF file) in real
time, then as it has a chance it commits them to the database file (the MDF
file). LDF files are basically flat files with sequential lines, MDF files are
much more complicated, so in the interest of speed SQL does not write directly
to the MDF file. Now, what it does with that transaction file after the changes
are committed to the MDF file are up to you. You didn't mention which version
of SQL you're using. That's pretty important since this is an SQL issue. In
general terms you need to do a backup of your MDF and LDF files with an SQL
aware process (either in SQL or using a back up program that is SQL aware). You
should be able to shrink your LDF file after that. You can also set the
Recovery Mode of your databases to Simple. That means that SQL flushes the
transaction from the LDF file once they are committed to the MDF file. It
doesn't automatically shrink the LDF file, but it is less likely that it will
grow as large. You can also set SQL to autoshrink the LDF and MDF files, but
I would not suggest it.