They believed in Thanos' vision and why he was doing it. Probably somewhat because they have been raised on his ideology as his own children: the group's nickname being the Children of Thanos. However, they do, or in some cases did, believe in his reasons. Gamora even used to and we see this when she talks to Thanos.
Thanos: Little one, it's a simple calculus. This universe is finite, its resources finite. If life is left unchecked, life will cease to exist. It needs correction.
Gamora: You don't know that!
Thanos: I'm the only one who knows that. At least, I'm the only one with the will to act on it. For a time... you had that same will... as you fought by my side. Daughter.
Avengers: Infinity War
Note that Thanos also could have been killed in his plan, taken from this answer. If he believed he could die, it's not a stretch to imagine that his children also felt the same and felt it to be a worthy sacrifice.
Q. What’s the possibility of Thanos killing himself when he snaps?
Russo: The possibility of him doing it?
Student: Yeah
Russo: As a part of his random execution? He could’ve- and you can ask if he allowed himself to be a part of that random process. He does have a very interesting look on his face. When we come back to him after the snap, before he disappears, a look of surprise.
Ebony Maw certainly seems to think it as more than just worthy to be picked but a privilege to be taken as part of the plan.
Ebony Maw: Hear me, and rejoice. You have had the privilege of being saved by the Great Titan.... You may think this is suffering... no. It is salvation. Universal scales tip toward balance because of your sacrifice. Smile... for even in death, you have become Children of Thanos.
Avengers: Infinity War
Ebony Maw: Hear me, and rejoice. You are about to die at the hands of the Children of Thanos. Be thankful, that your meaningless lives are now contributing to...
Avengers: Infinity War
Ebony Maw: Zehobereians... Choose a side, or die. One side is a revelation. The other, an honor known only to a few. Now go in peace, and meet your Maker.
Avengers: Infinity War