If the sentence begins with hardly, then sentence would read as "Hardly had we got into the forest when it began to rain" as 'hardly' takes the verb 'had'.. Therefore, 'Hardly have we got' must be replaced with 'We had hardly got' to keep the contextual part correct.