If your characters refuse to walk through a base gate, or enemies are running into walls, the navigation mesh is broken. This is the #1 fix.
Alternative faster method: Select your squad, click "Move" mode, and physically drag them out of the rock. Sometimes this works; sometimes it crashes.
Shift+F12 edits the actual map data of your current game session. While the game usually fixes itself upon reload, a misplaced click can delete a mountain. Go to Documents/Kenshi/save and copy your quick.save folder somewhere safe.
Here are some examples of what the editor and building manipulation look like in Kenshi: