One form of Javascript encapsulation is one of scope. There aren't modules as such - people just stuff things inside a function ((function(){ ... })(this)
) and the things inside of that function can't be used outside. You can hide quite a bit in local scope, and many languages have had it (though arguably, without first class functions this isn't enough for encapsulation of data).
Once we start mentioning first class functions and history, we firmly fall into talking about Lisp. And there's a lot there to be said too.
Early Fortran (for the 704) didn't have subroutines or scope. It was Fortran II that introduced these things.
My apologies for writing off Lisp (1958) with a single sentence... and not saying much about Fortran (1957), or Fortran II (1958). Lisp had closures and Fortran II appears to have some lexical scoping...
When you talk about encapsulation and structured programming the name that should jump out at you is Niklaus Wirth.
What we often think of as encapsulation are things like private variables within a module. Sure, you had things that could pop in and out of scope that couldn't be accessed outside of the scope. But you didn't have "here is this module of code that has some things that you just can't see over there".
It was Modula 2 (1978) that brought us syntax like:
DEFINITION MODULE M1;
EXPORT QUALIFIED a, b, c, P;
Where one could then later access M1.a
and M1.b
but not M1.d
(because that wasn't exported).
You could also do:
MODULE M2;
FROM M1 IMPORT a, P;
Some of the language looks downright Pythonish...
MODULE Hello;
FROM STextIO IMPORT WriteString;
BEGIN
WriteString("Hello World!");
END Hello.
This is more than just hiding something within some scope to not clobber name space. This is hiding the visibility of some variables, procedures or functions from other modules. (Tutorial on modules within Modula-2) This type of encapsulation is what we often think of now and see in languages like C++ (1983), Java (1995), and C# (2000).
Modula wasn't the only language to have some form of data hiding. Simula was an early object oriented language that had some data encapsulation:

This particular extension was from a later extension to the language from around 1972. This made its way into the standard of Simula 87 (the original Simula 67 had everything as public and lacked encapsulation). This language a strong influence on C++ (A Conversation with Bjarne Stroustrup, Why I Created C++).
This protection block for an identifier allowed a class to specify if its subclasses - Hidden
could only be used in the class where its declared and Protected
could only be used where it was declared and its subclasses.
One more mention from another old object oriented language - Smalltalk (1972).
In Smalltalk, all instance variables were protected (visible only to the class and its subclasses) and all methods were public (Smalltalk object model). This could be used to preform some encapsulation.
It was considered bad form to access an instance variable of the superclass from a subclass, or to invoke a method in the 'private' category).
Related reading: