How can I use menukeys inside a {forest} environment?

This is most likely caused by nesting tikzpicture environments. The simplest way to get around it would be to save your keys in \sboxes.

% !TEX TS-program = pdfLaTeX
\documentclass[12pt, a4paper]{article}
\usepackage[textwidth=16cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{forest}
\usepackage{menukeys}
\newsavebox{\keyA}
\sbox{\keyA}{\keys{A}}
\newsavebox{\keyB}
\sbox{\keyB}{\keys{B}}
\begin{document}
\section{Menu structure}

The menu can be navigated with the keyboard, from the main menu you can press \keys{A} to go the menu 2 or \keys{B} to go to menu 3.

\begin{forest}
  for tree={
    font=\ttfamily,
    grow'=0,
    child anchor=west,
    parent anchor=south,
    anchor=west,
    calign=first,
    edge path={
      \noexpand\path [draw, \forestoption{edge}]
      (!u.south west) +(7.5pt,0) |- node[fill,inner sep=1.25pt] {} (.child anchor)\forestoption{edge label};
    },
    before typesetting nodes={
      if n=1
        {insert before={[,phantom]}}
        {}
    },
    fit=band,
    before computing xy={l=15pt},
  }
[Main menu
  [ \usebox{\keyA} $\rightarrow$ Menu 2
    [Foo]
    [Bar]
    [Baz]
  ]
  [\usebox{\keyB} $\rightarrow$ Menu 3
    [Quux]
  ]
]
\end{forest}

\end{document}

output of code