Lefschetz hyperplane theorem states that if we take a hypersurface section of a projective manifold, then we have some relations on the homology or homotopy groups of hyperplane and the ambient manifold. However, can we loose some condition,
(1) What if we take a nonhypersurface section, or a nonample divisor
(2) What if I take a nonprojective or a nonKahler manifold, say, a strict almost complex manifold?
For (1), I tried to think blow up a point in $\mathbb{C}P^2$, but it does not work as I did not change the fundamental group.
If by "non hypersurface section" you mean something of complex codimension bigger than 1 then pretty much any curve in $CP^3$ will do (if the genus is nonzero then it has different fundamental group from $CP^3$). For nonample divisors, you could take two curves $C$ and $D$ of positive genus and then $C\subset C\times D$ is a nonample divisor with different fundamental group from $C\times D$.
If you drop the projectivity condition, it's not clear what "hyperplane section" means: there are no ample divisors, as these would give you a projective embedding. I'll say more about one way you could make sense of this below, but first I want to discuss how I understand the Lefschetz hyperplane theorem.
One way to think about the Lefschetz hyperplane theorem which makes it clear exactly what geometry is being used is the following. Let $X$ be a projective variety and $D\subset X$ be a hyperplane section. The complement $X\setminus D$ is an affine variety. An affine variety of complex dimension n deformation retracts onto a cell complex of real dimension n called the "skeleton" (this is the content of the theorem). For example this argument is due to Andreotti and Frankel, and is explained in Milnor's book on Morse theory.
The usual statement is implied by this reformulation as follows:
Now think about what happens when you start dropping hypotheses: if the codimension of D is bigger or the divisor is not ample then the complement of D is not going to be an affine variety.
For nonKaehler/nonprojective things: if $(X,\omega)$ is a symplectic manifold you could weaken the ampleness condition to say that D is Poincaré dual to the symplectic form. Then you have some hope that the complement of D could be "like an affine variety" because the symplectic form is exact on the complement. Donaldson proved that any symplectic manifold with $[\omega]$ an integral class contains a symplectic codimension 2 submanifold in the class Poincaré dual to $k[\omega]$ for some integer k whose complement is a Weinstein domain: Weinstein domains share the same property that affine varieties have of retracting onto a real n-dimensional cell complex, so the Lefschetz hyperplane theorem is true for these Donaldson divisors. But Denis Auroux gave examples (in his thesis) of symplectic submanifolds in the class $[\omega]$ whose complement is not Weinstein, and the Lefschetz hyperplane theorem fails for these (I don't remember what these examples were precisely, but they were relatively benign).