Yes, it is fine for the spouse to remain in the US in H-4 status while the primary visa holder travels as long as he maintains his H-1B when he is in the US and continues working for the H-1B employer.