First of all, I'd like to ask a few questions to get a better overview of your situation and because I'm not sure if I understood you correctly: Did you already apply for asylum? Did you already get Duldung?
Now let me try to answer your question(s):
I assume that your Schengen visa expired. That would explain why police arrested you when you came back from France.
To legalize your stay it would be best if you went back to Algeria in order to return to Germany with a proper visa (please keep in mind the answer that I gave you to your other question in this regard: https://***.wefugees.de/800203/married-german-woman-have-back-home-country-come-back-with-visa?show=800206#a800206). Of course that's time consuming and expensive (and it seems to be totally unncessary), but it's lawful for Ausländerbehörde to ask you to do that. I'm not familiar with the situation in Algeria and the details of your case, so I can't tell you if you will be able to return or not. You have to decide on your own if you are willing to take that risk. But it would be the safest way to get a residence permit that allows you to stay in Germany with your wife permanently.
The other option would be to legalize your stay by applying for asylum (if you didn't do that already). But keep in mind that the residence permit you get through your marriage grants you way more rights (e.g. you will be allowed to live/work in EU). In addition, you don't know the outcome of your asylum procedure and you could end up being rejected.