The object which you are looking for is ProcessInstanceHistory.
This read-only object shows all steps and pending approval requests associated with an approval process (ProcessInstance).
You can’t query
ProcessInstanceHistory. Instead, you can query
ProcessInstanceHistory by including it in a nested query on the parent
ProcessInstance object. For example, the following SOQL query returns all the
ProcessInstanceHistory records related to individual
The nested query references
StepsAndWorkitems, which is the child relationshipName for
ProcessInstanceHistory in the
SELECT Id, TargetObjectId, (SELECT Id, StepStatus, Comments FROM StepsAndWorkitems where StepStatus='Pending')
FROM ProcessInstance where TargetObjectId in: caseIds
See this thread for more information: How to Approve the record through Apex Programming.