Traversing through single large array to convert single array into array of arrays as per condition
Observations and Remarks

Your code is pretty complex and hard to read, as it involves a
callback with a complex outside state encoded within the global
revious_sub, capture and file_no variables. Each time your
callback is executed, it modifies some of those state variables =
there are many side-effects, which makes things confusing.
The variable capture is unused.
Not all variables are declared and thus become global.
Your sample input seems to be a list of strings, but within your
callback you access the path via testfile = file.relativePath;
indicating that you deal with objects.
It doesn't seem necessary to me to perform a basic array operation
without IO delays asynchronously. So I recommend a simpler
synchronous function.
Your resulting grouped file list is not very useful, as its groups
are unnamed. If we want to know the 'sub-*' prefix of a group, we
would have to manually inspect a random group element. An explicit
mapping from prefix or name to file would allow us to query e.g.
groups.get('sub-03') in constant time.
Your current implementation requires a sorted input file list. By
using a Map, you can guarantee the same runtime complexity without
having to rely on sorted input.

Suggested Implementation
Write a general purpose groupBy helper function or use a library which already includes one. Such a function would group array elements by their label or name. The user supplies a callback which returns the label or name for each array element:
function groupBy(array, cp) {
    return array.reduce((groups, next) =&gt; {
        const name = cp(next);
        if (name !== undefined) {
            const group = groups.get(name);
            if (group) group.push(next);
            else groups.set(name, [next]);
        }
        return groups;
    }, new Map());
}

For a given list of file paths, you could then simply write:
const files = [
    '/sub-09/func/sub-09_task-genInstrAv_run-05_physio.tsv.gz',
    '/sub-10/anat/sub-10_T1w.json',
    '/sub-10/anat/sub-10_T1w.nii.gz',
    '/sub-10/fmap/sub-10_magnitude1.nii.gz',
    '/sub-10/fmap/sub-10_magnitude2.nii.gz',
    '/sub-10/fmap/sub-10_phasediff.json',
    '/sub-10/fmap/sub-10_phasediff.nii.gz',
    '/sub-11/anat/sub-11_T1w.nii.gz'
];

const groups = groupBy(files, path =&gt; {
    const match = path.match(/^\/(sub-\w+)\//);
    if (match) return match[1];
});

If your file list is made up of objects instead of strings, you could write:
const groups = groupBy(files, file =&gt; {
    const match = file.relativePath.match(/^\/(sub-\w+)\//);
    if (match) return match[1];
});

The result is a Map { &quot;sub-09&quot; → […], &quot;sub-10&quot; → […], &quot;sub-11&quot; → […] } which we can query via e.g. groups.get('sub-09') or transform into your array of arrays via e.g. [...groups.values()].