Is it possible to get vertex locations (world) from a vertex group?
Copy Location Constraint.

From https://blender.stackexchange.com/a/139758/15543



Can leverage the existing behaviour of the copy location constraint, targeted to a mesh, subtargeted to a vertex group.

Test script, run in object mode with mesh object selected. Will add an empty for each vertex group at the mean location (as determined by constraint) of each vertex group.

import bpy

context = bpy.context

ob = context.object
me = ob.data

for name in ob.vertex_groups.keys():
    bpy.ops.object.empty_add(location=(0, 0, 0))
    mt = context.object
    mt.name = f"{ob.name}_{name}"
    cl = mt.constraints.new('COPY_LOCATION')
    cl.target = ob
    cl.subtarget = name



  Thanks, this gives me the center of the vertex group. Is it possible
  to get the location of all vertices (not only the center)?


Or using another slightly updated example from https://blender.stackexchange.com/a/139758/15543

this one adds an empty parented to each vertex in the vertex group.

For vertex group named "Group" containing vertex index 3, there will be an empty object mt named "Group_3" parented to vertex 3.  At any frame the global location of vertex 3 will be mt.matrix_world.translation.

import bpy
from collections import defaultdict
context = bpy.context

vgs = defaultdict(list)
ob = context.object
me = ob.data
for v in me.vertices:
    for g in v.groups:
        vgs[ob.vertex_groups[g.group].name].append(v.index)

for name, vg in vgs.items():
    for i in vg:
        bpy.ops.object.empty_add(location=(0, 0, 0))

        mt = context.object
        mt.parent = ob
        # mt.name = "%s_%d" % (name, i) # for python &lt; 3.6
        mt.name = f"{name}_{i}"
        mt.parent_type = 'VERTEX'
        mt.parent_vertices = (i,) * 3


Note would be a good idea here to jam empties into new linked collection, so they can be removed / hidden easily

Another way is to use one of the solutions outlined here

How do I get a mesh data-block with modifiers and shape keys applied in Blender 2.8?

for a modified mesh. However if you have a subsurf, for example,  will have a lot of extra generated vertices.