The Avengers director gave the news during the recent Comic-Con convention in San Diego, where he celebrated the tenth anniversary of his series Firefly.
According to The Hollywood Reporter, Whedon will guest on three eight-minute episodes of the series, playing the agent of an openly gay baseball star played by Sean Hemeon.
Whedon and Espenson are longtime friends, as Espenson was co-executive producer on Buffy the Vampire Slayer and a consulting producer on his more recent series Dollhouse.
The director himself has a history with web series, as his own online show Dr. Horrible's Sing-Along Blog won an Emmy in 2009. The series is due to air on The CW this fall.
The second season premiere of Husbands debuts on August 15.