Assuming you don't need the thing in subscripts or superscripts, the easiest way is to exit from math mode, doubling the \thinmuskip, reentering math mode, typesetting the lists and go back.
\documentclass{article}
\usepackage{amsmath}
\newcommand{\cls}[2]{%
\mathord{\mbox{%
\thinmuskip=2\thinmuskip
$(#1\mid#2)$%
}}%
}
\begin{document}
$( a, b,c,d \mid e,f,g,h)$
$(a,\, b,\, c,\, d \mid e,\, f,\, g,\, h)$
$\cls{a,b,c,d}{e,f,g,h}$
\end{document}

A different solution that allows for resizing the parentheses as usual for commands defined with \DeclarePairedDelimiter, see the examples. It also has a friendlier syntax.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\AtBeginDocument{\mathchardef\clscomma=\mathcode`, }
\ExplSyntaxOn
\NewDocumentCommand{\cls}{som}
{
\group_begin:
\IfBooleanTF{#1}
{
\hs_cls_auto:n { #3 }
}
{
\hs_cls_manual:nn { #2 } { #3 }
}
\group_end:
}
\cs_new_protected:Nn \hs_cls_auto:n
{
\__hs_cls_activate_comma:
\__hs_cls_activate_bar:n { \;\middle\vert\; }
\left( #1 \right)
}
\cs_new_protected:Nn \hs_cls_manual:nn
{
\__hs_cls_activate_comma:
\__hs_cls_activate_bar:n { \__hs_cls_mid:n {#1} }
\__hs_cls_open:n {#1} #2 \__hs_cls_close:n {#1}
}
\cs_new_protected:Nn \__hs_cls_activate_comma:
{
\char_set_active_eq:nN { `, } \__hs_cls_comma:
\mathcode`,="8000 \scan_stop:
}
\cs_new_protected:Nn \__hs_cls_comma: { \clscomma\, }
\cs_new_protected:Nn \__hs_cls_activate_bar:n
{
\cs_set_protected:Nn \__hs_cls_bar: { #1 }
\char_set_active_eq:nN { `| } \__hs_cls_bar:
\mathcode`|="8000 \scan_stop:
}
\cs_new_protected:Nn \__hs_cls_open:n
{
\tl_if_novalue:nTF { #1 } { ( } { \mathopen{#1(} }
}
\cs_new_protected:Nn \__hs_cls_mid:n
{
\tl_if_novalue:nTF { #1 } { \mid } { \mathrel{#1\vert} }
}
\cs_new_protected:Nn \__hs_cls_close:n
{
\tl_if_novalue:nTF { #1 } { ) } { \mathclose{#1)} }
}
\ExplSyntaxOff
\begin{document}
$( a, b,c,d \mid e,f,g,h)$
$(a,\, b,\, c,\, d \mid e,\, f,\, g,\, h)$
$\cls{a,b,c,d|e,f,g,h}$
$\cls[\Big]{a,b,c,d|e,f,g,h}$
$\cls*{\dfrac{a}{2},b,c,d|e,f,g,h}$
\end{document}

\[\begin{pmatrix}a&b&c&d&e&f&g&h\end{pmatrix}\](don't forget to add\usepackage{amsmath}to the preamble) could be an option. – manooooh Jul 25 '19 at 17:36