It depends on the composition whether you can.
This spell enables you or a creature you touch to move and attack
normally for the duration of the spell, even under the influence of
magic that usually impedes movement, such as paralysis, solid fog,
slow, and web.
You can move and attack normally if your movement is impeded by objects in the way. If the dirt is simply loose dirt that they can slowly move through, that would apply. However, cave ins, or being buried in earth are not necessarily like that.
Characters who aren’t buried can dig out their friends. In 1 minute,
using only her hands, a character can clear rocks and debris equal to
five times her heavy load limit. The amount of loose stone that fills
a 5-foot-by-5-foot area weighs 1 ton (2,000 pounds). Armed with an
appropriate tool, such as a pick, crowbar, or shovel, a digger can
clear loose stone twice as quickly as by hand. A buried character can
attempt to free himself with a DC 25 Strength check.
The solid earth and rock requires a strength check to move- it essentially acts as a solid wall that you need to displace. It's not a clear interpretation of freedom of movement that it lets you teleport through walls.
However, if you are ok with letting them use escape artist to escape, it probably does allow them to autosucceed.
The subject automatically succeeds on any combat maneuver checks and
Escape Artist checks made to escape a grapple or a pin.
If there's simply an escape artist check to get out of the dirt, though the rules don't clearly say that objects doing grapples or pins can also be escaped, it makes sense they'd follow the same rules.
This is uncharted territory because you are using a house rule for how to escape being under several feet of earth. Your house rule would reasonably allow them to escape, since the earth is essentially grappling them, rather than serving as a physical barrier than needs to be burst.