No problem traveling to and from the US on H1B during your spouse visa process. Remember that H1B is a dual-intent visa, which means it's fine for you to seek immigrant status while on H1B. It's even an option for you to show up at the border with your H1B and declare to CBP that you will apply to adjust status during your stay. Of course, it's also fine if you prefer to return to India to complete your spouse visa process instead.
Here's what the Department of State's manual says about H1B's dual-intent nature -- https://fam.state.gov/fam/09FAM/09FAM040210.html#M402_10_10_A
"[...] INA 214(h) provides that an H-1B nonimmigrant may have "dual intent," i.e., the fact that an H-1B nonimmigrant has sought permanent residence in the United States or will be seeking such status in the future does not preclude him or her from obtaining or maintaining H-1B nonimmigrant status. The applicant may legitimately come to the United States as a nonimmigrant under the H-1B classification and depart voluntarily at the end of their authorized period of stay, and, at the same time, lawfully seek to become a permanent resident of the United States without jeopardizing H-1B nonimmigrant status. Consequently, your evaluation of an applicant’s eligibility for an H-1B visa must not focus on the issue of immigrant intent."